- Timestamp:
- Feb 24, 2012, 10:28:31 AM (13 years ago)
- google:author:
- gregli@hotmail.com
- Location:
- trunk/XTIDE_Universal_BIOS
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Inc/RamVars.inc
r258 r262 10 10 ; Variables for translating drive numbers. 11 11 struc XLATEVARS 12 .wFDandHDswap:13 .bFDSwap resb 1 ; Floppy Drive to swap to 00h and vice versa14 .bHDSwap resb 1 ; Hard Drive to swap to 80h and vice versa15 .bXlatedDrv resb 1 ; Drive number after translation16 12 %ifdef MODULE_SERIAL_FLOPPY 17 13 .bFlopCreateCnt: … … 23 19 resb 1 ; alignment 24 20 %endif 21 .bXlatedDrv resb 1 ; Drive number after translation 22 .wFDandHDswap: 23 .bFDSwap resb 1 ; Floppy Drive to swap to 00h and vice versa 24 .bHDSwap resb 1 ; Hard Drive to swap to 80h and vice versa 25 25 endstruc 26 26 … … 36 36 .wDrvCntAndFirst: 37 37 .bFirstDrv resb 1 ; Number of first drive for this BIOS 38 .wDrvCntAndFlopCnt: ; Both the hard disk and floppy counts in one word 39 ; (yes, misaligned, but it is only used this way during initialization) 38 40 .bDrvCnt resb 1 ; Number of drives handled by this BIOS 39 41 … … 41 43 .xlateVars resb XLATEVARS_size 42 44 endstruc 45 46 %ifdef MODULE_SERIAL_FLOPPY 47 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS 48 %if RAMVARS.xlateVars != RAMVARS.bDrvCnt+1 || XLATEVARS.bFlopCreateCnt != 0 49 %error "bFlopCreateCnt needs to be the first thing in XLATEVARS, and .xlateVars needs to come immediately after .bDrvCnt. In at least one place, we read .wDrvCntAndFlopCnt to get both counts in one fetch" 50 %endif 51 %endif 52 %endif 43 53 44 54 RAMVARS_SIGNATURE EQU "Xu" ; RAMVARS signature for .wSignature -
trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm
r259 r262 23 23 mov bp, sp 24 24 25 call RamVars_IsDriveHandledByThisBIOS_And_FindDPT_ForDriveNumber25 call FindDPT_ForDriveNumberInDL 26 26 jc .notOurs 27 27 … … 111 111 mov si, g_szCapacity ; Setup print string now, carries through to print call 112 112 113 xor di, di ; Zero DI for checks for our drive later on 114 call RamVars_IsDriveHandledByThisBIOS_And_FindDPT_ForDriveNumber 115 116 test dl, dl ; are we a hard disk? 117 js BootMenuPrint_HardDiskRefreshInformation 118 119 test di, di 120 jnz .ours ; Based on CF from RamVars_IsDriveHandledByThisBIOS above 113 call FindDPT_ForDriveNumberInDL 114 115 inc dl ; are we a hard disk? 116 dec dl ; inc/dec will set SF, without modifying CF or DL 117 js .HardDiskRefreshInformation 118 119 jnc .ours ; Based on CF from FindDPT_ForDriveNumberInDL above 121 120 call FloppyDrive_GetType ; Get Floppy Drive type to BX 122 121 jmp .around … … 190 189 ;-------------------------------------------------------------------- 191 190 ALIGN JUMP_ALIGN 192 BootMenuPrint_HardDiskRefreshInformation: 193 test di, di 194 jz .HardDiskMenuitemInfoForForeignDrive 191 .HardDiskRefreshInformation: 192 jc .HardDiskMenuitemInfoForForeignDrive ; Based on CF from FindDPT_ForDriveNumberInDL (way) above 195 193 196 194 .HardDiskMenuitemInfoForOurDrive: 197 ePUSH_T ax, g_szInformation ; Add substring for our hard disk information198 call BootMenuInfo_GetTotalSectorCount ; Get Total LBA Size195 ePUSH_T ax, g_szInformation ; Add substring for our hard disk information 196 call BootMenuInfo_GetTotalSectorCount ; Get Total LBA Size 199 197 jmp .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat 200 198 -
trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm
r258 r262 639 639 pop si 640 640 %ifdef MODULE_SERIAL_FLOPPY 641 j c .founddpt641 jnc .founddpt 642 642 ; 643 643 ; If not found above with FindDPT_ToDSDIforSerialDevice, DI will point to the DPT after the last hard disk DPT -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm
r260 r262 26 26 27 27 call RamVars_GetSegmentToDS 28 28 29 call DriveXlate_ToOrBack 29 30 mov [RAMVARS.xlateVars+XLATEVARS.bXlatedDrv], dl 30 call RamVars_IsFunctionHandledByThisBIOS 31 jc SHORT Int13h_DirectCallToAnotherBios 32 33 call FindDPT_ForDriveNumber ; DS:DI now points to DPT 34 31 32 call FindDPT_ForDriveNumberInDL ; DS:DI points to our DPT, or NULL if not our drive 33 jnc SHORT .OurFunction ; DPT found, this is one of our drives, and thus our function 34 35 cmp ah, 0 36 jz short .OurFunction ; we handle all function 0h requests (resets) 37 cmp ah, 8 38 %ifdef MODULE_SERIAL_FLOPPY 39 jnz SHORT Int13h_DirectCallToAnotherBios ; we handle all traffic for function 08h, 40 ; as we need to wrap both hard disk and floppy drive counts 41 %else 42 jz SHORT .WeHandleTheFunction ; we handle all *hard disk* (only) traffic for function 08h, 43 ; as we need to wrap the hard disk drive count 44 test dl, dl 45 jns SHORT Int13h_DirectCallToAnotherBios 46 %endif 47 48 .OurFunction: 35 49 ; Jump to correct BIOS function 36 50 eMOVZX bx, ah -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm
r259 r262 121 121 GetDriveNumberForForeignBiosesToDL: 122 122 mov dl, bl 123 call RamVars_IsDriveHandledByThisBIOS124 j cSHORT .Return ; Return what was in BL unmodified123 test di, di 124 jz SHORT .Return ; Return what was in BL unmodified 125 125 mov dl, 80h 126 126 .Return: … … 141 141 ALIGN JUMP_ALIGN 142 142 AH0h_ResetHardDisksHandledByOurBIOS: 143 mov dx, [RAMVARS.wDrvCntAndFirst] ; DL = drive number, DH = drive count 144 test dh, dh 145 jz SHORT .AllDrivesReset ; Return if no drives 146 add dh, dl ; DH = one past last drive to reset 147 ALIGN JUMP_ALIGN 148 .DriveResetLoop: 149 call AHDh_ResetDrive 150 call .BackupErrorCodeFromMasterOrSlaveToBH 151 inc dx 152 cmp dl, dh ; All done? 153 jb SHORT .DriveResetLoop ; If not, reset next drive 154 .AllDrivesReset: 143 mov bl, [di+DPT.bIdevarsOffset] ; replace drive number with Idevars pointer for comparisons 144 mov cl, [cs:ROMVARS.bIdeCnt] ; get count of ide controllers 145 mov ch, 0 146 mov dl, 0 ; starting Idevars offset 147 mov si, IterateFindFirstDPTforIdevars ; iteration routine 148 .loop: 149 call IterateAllDPTs ; look for the first drive on this controller, if any 150 jc .notFound 151 call AHDh_ResetDrive ; reset master and slave on that controller 152 call BackupErrorCodeFromTheRequestedDriveToBH ; save error code if same controller as initial request 153 .notFound: 154 add dl, IDEVARS_size ; move pointer forward 155 loop .loop ; and repeat 155 156 ret 156 157 157 158 158 ;-------------------------------------------------------------------- 159 ; .BackupErrorCodeFromMasterOrSlaveToBH 160 ; Parameters: 161 ; AH: Error code for drive DL reset 162 ; BL: Requested drive (DL when entering AH=00h) 163 ; DL: Drive just resetted 164 ; DS: RAMVARS segment 165 ; Returns: 166 ; BH: Backuped error code 167 ; DL: Incremented if next drive is slave drive 168 ; (=already resetted) 169 ; Corrupts registers: 170 ; CX, DI 159 ; Iteration routine for AH0h_ResetHardDisksHandledByOurBIOS, 160 ; for use with IterateAllDPTs 161 ; 162 ; Returns when DPT is found on the controller with Idevars offset in DL 171 163 ;-------------------------------------------------------------------- 172 ALIGN JUMP_ALIGN 173 .BackupErrorCodeFromMasterOrSlaveToBH: 174 call BackupErrorCodeFromTheRequestedDriveToBH 175 call GetBasePortToCX ; Load base port for resetted drive 176 push cx 177 inc dx ; DL to next drive 178 call GetBasePortToCX 179 pop di 180 cmp cx, di ; Next drive is from same controller? 181 je SHORT BackupErrorCodeFromTheRequestedDriveToBH 182 .NoMoreDrivesOrNoSlaveDrive: 183 dec dx 164 IterateFindFirstDPTforIdevars: 165 cmp dl, [di+DPT.bIdevarsOffset] ; Clears CF if matched 166 jz .done 167 stc ; Set CF for not found 168 .done: 184 169 ret 185 186 187 ;--------------------------------------------------------------------188 ; GetBasePortToCX189 ; Parameters:190 ; DL: Drive number191 ; DS: RAMVARS segment192 ; Returns:193 ; CX: Base port address194 ; CF: Set if valid drive number195 ; Cleared if invalid drive number196 ; Corrupts registers:197 ; DI198 ;--------------------------------------------------------------------199 ALIGN JUMP_ALIGN200 GetBasePortToCX:201 xchg cx, bx202 xor bx, bx203 call FindDPT_ForDriveNumber204 mov bl, [di+DPT.bIdevarsOffset]205 mov bx, [cs:bx+IDEVARS.wPort]206 xchg bx, cx207 ret208 209 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH8h_HParams.asm
r261 r262 25 25 ;-------------------------------------------------------------------- 26 26 AH8h_HandlerForReadDiskDriveParameters: 27 28 call RamVars_IsDriveHandledByThisBIOS 29 jnc SHORT .OurDrive 27 test di,di 28 jnz SHORT .OurDrive 30 29 31 30 call Int13h_CallPreviousInt13hHandler -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm
r200 r262 40 40 ; CF: 0 if succesfull, 1 if error 41 41 ; Corrupts registers: 42 ; AL, CX, SI , DI42 ; AL, CX, SI 43 43 ;-------------------------------------------------------------------- 44 44 ;ALIGN JUMP_ALIGN … … 46 46 push dx 47 47 push bx 48 push di 48 49 49 call FindDPT_ForDriveNumber ; DS:DI now points to DPT50 50 call Interrupts_UnmaskInterruptControllerForDriveInDSDI 51 51 call Device_ResetMasterAndSlaveController 52 ;jc SHORT .ReturnError ; CF would be set if slave drive present without master53 ; (error register has special values after reset)52 ;jc SHORT .ReturnError ; CF would be set if slave drive present without master 53 ; (error register has special values after reset) 54 54 55 55 ; Initialize Master and Slave drives 56 eMOVZX bx, BYTE [di+DPT.bIdevarsOffset] 57 mov dx, [cs:bx+IDEVARS.wPort] 58 call InitializeMasterAndSlaveDriveFromPortInDX 56 mov al, [di+DPT.bIdevarsOffset] ; pointer to controller we are looking to reset 57 mov ah, 0 ; initialize error code, assume success 58 59 mov si, IterateAndResetDrives 60 call IterateAllDPTs 59 61 62 shr ah, 1 ; Move error code and CF into proper position 63 64 pop di 60 65 pop bx 61 66 pop dx 62 67 ret 63 68 64 65 69 ;-------------------------------------------------------------------- 66 ; InitializeMasterAndSlaveDriveFromPortInDX 67 ; Parameters: 68 ; DX: IDE Base Port address 69 ; SS:BP: Ptr to IDEPACK 70 ; Returns: 71 ; AH: Error code 72 ; CF: 0 if initialization succesfull 73 ; 1 if any error 74 ; Corrupts registers: 75 ; AL, BX, CX, DX, SI, DI 70 ; IterateAndResetDrives: Iteration routine for use with IterateAllDPTs. 71 ; 72 ; When a drive on the controller is found, it is reset, and the error code 73 ; merged into overall error code for this controller. Master will be reset 74 ; first. Note that the iteration will go until the end of the DPT list. 76 75 ;-------------------------------------------------------------------- 77 ALIGN JUMP_ALIGN 78 InitializeMasterAndSlaveDriveFromPortInDX: 79 push dx ; Store base port address 80 xor cx, cx ; Assume no errors 81 FindDPT_ToDSDIForIdeMasterAtPortDX 82 jnc SHORT .InitializeSlave ; Master drive not present 83 call AH9h_InitializeDriveForUse 84 mov cl, ah ; Copy error code to CL 85 .InitializeSlave: 86 pop dx ; Restore base port address 87 FindDPT_ToDSDIForIdeSlaveAtPortDX 88 jnc SHORT .CombineErrors ; Slave drive not present 89 call AH9h_InitializeDriveForUse 90 mov ch, ah ; Copy error code to CH 91 .CombineErrors: 92 or cl, ch ; OR error codes, clear CF 93 jz SHORT .Return 94 mov ah, RET_HD_RESETFAIL ; Load Reset Failed error code 95 stc 96 .Return: 76 IterateAndResetDrives: 77 cmp al, [di+DPT.bIdevarsOffset] ; The right controller? 78 jnz .done 79 push ax 80 call AH9h_InitializeDriveForUse ; Reset Master and Slave (Master will come first in DPT list) 81 pop ax 82 jc .done 83 or ah, (RET_HD_RESETFAIL << 1) | 1 ; OR in Reset Failed error code and CF, will SHR into position later 84 .done: 85 stc ; From IterateAllDPTs perspective, the DPT is never found 97 86 ret 87 -
trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm
r261 r262 37 37 38 38 %ifdef MODULE_SERIAL 39 jcxz . done; Set to zero on .ideVarsSerialAuto iteration (if any)39 jcxz .AddHardDisks ; Set to zero on .ideVarsSerialAuto iteration (if any) 40 40 %endif 41 41 … … 48 48 ; 49 49 call FindDPT_ToDSDIforSerialDevice 50 j c .done50 jnc .AddHardDisks 51 51 52 52 mov bp, ROMVARS.ideVarsSerialAuto ; Point to our special IDEVARS structure, just for serial scans … … 58 58 %endif 59 59 60 .done: 61 %ifdef MODULE_SERIAL_FLOPPY 60 .AddHardDisks: 62 61 ;---------------------------------------------------------------------- 63 62 ; 64 ; Add in any emulated serial floppy drives. 65 ; 66 mov al, [RAMVARS.xlateVars+XLATEVARS.bFlopCreateCnt] 67 dec al 68 mov cl, al 69 js .NoFloppies ; if no drives are present, we store 0ffh 63 ; Add in hard disks to BDA, finalize our Count and First variables 64 ; 65 mov cx, [RAMVARS.wDrvCntAndFlopCnt] ; Our count of hard disks 66 test cl, cl 67 jz .AddFloppies ; If none, nothing more to do 68 69 mov al, [es:BDA.bHDCount] 70 add cl, al ; Add our drives to the system count 71 mov [es:BDA.bHDCount], cl 72 or al, 80h ; Or in hard disk flag 73 mov [RAMVARS.bFirstDrv], al ; Store first drive number 74 75 76 .AddFloppies: 77 ;%ifdef MODULE_SERIAL_FLOPPY 78 ;---------------------------------------------------------------------- 79 ; 80 ; Add in any emulated serial floppy drives, finalize our packed Count and First variables 81 ; 82 dec ch 83 mov al, ch 84 js .NoFloppies ; if no drives are present, we store 0ffh 70 85 71 86 call FloppyDrive_GetCountFromBIOS_or_BDA … … 73 88 push ax 74 89 75 add al, c l; Add our drives to existing drive count90 add al, ch ; Add our drives to existing drive count 76 91 cmp al, 3 ; For BDA, max out at 4 drives (ours is zero based) 77 92 jl .MaxBDAFloppiesExceeded … … 92 107 pop ax 93 108 94 shr c l, 1 ; number of drives, 1 or 2 only, to CF flag (clear=1, set=2)109 shr ch, 1 ; number of drives, 1 or 2 only, to CF flag (clear=1, set=2) 95 110 rcl al, 1 ; starting drive number in upper 7 bits, number of drives in low bit 96 111 .NoFloppies: 97 112 mov [RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst], al 98 %endif113 ;%endif 99 114 100 115 ret -
trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm
r254 r262 43 43 mov dx, [cs:bp+IDEVARS.bDevice-1] ; for Serial: AL=port address>>2, AH=baud rate 44 44 ; DL=COM number character, DH=.bDevice 45 45 46 mov si, g_szDetectOuter ; Load SI with default wrapper string "IDE %s at %s: " 47 46 48 push bp ; setup stack for call to 47 49 mov bp, sp ; BootMenuPrint_FormatCSSIfromParamsInSSBP … … 72 74 73 75 test dl, dl ; Check if serial port "Auto" 74 jz .pushAndPrint 76 jz .pushAndPrintSerial ; CX = string to print, AX and DX won't be used 75 77 76 78 mov cl, (g_szDetectCOMLarge-$$) & 0xff ; Setup secondary print string for "COMn/xx.yK" … … 88 90 89 91 cmp ax,si ; < 10: "2400", "9600", etc.; >= 10: "19.2K", "38.4K", etc. 90 jae .pushAndPrint 92 jae .pushAndPrintSerial 91 93 92 94 mov cl, (g_szDetectCOMSmall-$$) & 0xff ; Setup secondary print string for "COMn/XXy00" 95 96 .pushAndPrintSerial: 97 mov si, g_szDetectOuterSerial ; Finally load SI with wrapper string "Serial %s on %s: " 93 98 94 99 .pushAndPrint: … … 96 101 push ax ; Push high order digits, or port address, or N/A 97 102 push dx ; Push low order digit, or N/A 98 99 mov si, g_szDetectOuter ; Finally load SI with wrapper string "IDE %s at %s: "100 103 101 104 jmp short DetectPrint_BootMenuPrint_FormatCSSIfromParamsInSSBP_Relay -
trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm
r259 r262 72 72 .StoreDptPointersToIntVectors: 73 73 mov dl, 80h 74 call RamVars_IsDriveHandledByThisBIOS_And_FindDPT_ForDriveNumber; DPT to DS:DI74 call FindDPT_ForDriveNumberInDL ; DPT to DS:DI 75 75 jc SHORT .FindForDrive81h ; Store nothing if not our drive 76 76 mov [es:HD0_DPT_POINTER_41h*4], di … … 78 78 .FindForDrive81h: 79 79 inc dx 80 call RamVars_IsDriveHandledByThisBIOS_And_FindDPT_ForDriveNumber80 call FindDPT_ForDriveNumberInDL 81 81 jc SHORT .ResetDetectedDrives 82 82 mov [es:HD1_DPT_POINTER_46h*4], di -
trunk/XTIDE_Universal_BIOS/Src/Strings.asm
r252 r262 17 17 g_szDetectSlave: db "Slave ",NULL 18 18 g_szDetectOuter: db "IDE %s at %s: ",NULL 19 g_szDetectOuterSerial: db "Serial %s on %s: ",NULL 19 20 g_szDetectPort: db "%x",NULL ; IDE Master at 1F0h: 20 21 g_szDetectCOM: db "COM%c%s",NULL 21 g_szDetectCOMAuto: db " Auto",NULL22 g_szDetectCOMAuto: db " Detect",NULL 22 23 g_szDetectCOMSmall: db "/%u%u00",NULL ; IDE Master at COM1/9600: 23 24 g_szDetectEnd: … … 70 71 db "Addr.",SINGLE_VERTICAL,"Block",SINGLE_VERTICAL,"Bus",SINGLE_VERTICAL, "IRQ",SINGLE_VERTICAL,"Reset",LF,CR 71 72 db "%s",SINGLE_VERTICAL, "%5-u",SINGLE_VERTICAL, "%s",SINGLE_VERTICAL," %2-I",SINGLE_VERTICAL,"%5-x" ,NULL 72 73 ; Boot Menu Floppy Disk strings74 ;75 ; The following strings are used by BootMenuPrint_RefreshInformation76 ; To support optimizations in that code, these strings must start on the same 256 byte page,77 ; which is checked at assembly time below.78 ;79 g_szFddStart:80 g_szFddUnknown: db "Unknown",NULL81 g_szFddSizeOr: db "5",ONE_QUARTER,QUOTATION_MARK," or 3",ONE_HALF,QUOTATION_MARK," DD",NULL82 g_szFddSize: db "%s",QUOTATION_MARK,", %u kiB",NULL ; 3½", 1440 kiB83 g_szFddThreeHalf: db "3",ONE_HALF,NULL84 g_szFddEnd:85 g_szFddFiveQuarter: db "5",ONE_QUARTER,NULL86 87 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS88 %if ((g_szFddStart-$$) & 0xff00) <> ((g_szFddEnd-$$) & 0xff00)89 %error "g_szFdd* strings must start on the same 256 byte page, required by the BootMenuPrint_RefreshInformation routines for floppy drives. Please move this block up or down within strings.asm"90 %endif91 %endif92 73 93 74 g_szAddressingModes: … … 151 132 g_szDashForZero: db "- ",NULL 152 133 134 ; Boot Menu Floppy Disk strings 135 ; 136 ; The following strings are used by BootMenuPrint_RefreshInformation 137 ; To support optimizations in that code, these strings must start on the same 256 byte page, 138 ; which is checked at assembly time below. 139 ; 140 g_szFddStart: 141 g_szFddUnknown: db "Unknown",NULL 142 g_szFddSizeOr: db "5",ONE_QUARTER,QUOTATION_MARK," or 3",ONE_HALF,QUOTATION_MARK," DD",NULL 143 g_szFddSize: db "%s",QUOTATION_MARK,", %u kiB",NULL ; 3½", 1440 kiB 144 g_szFddThreeHalf: db "3",ONE_HALF,NULL 145 g_szFddEnd: 146 g_szFddFiveQuarter: db "5",ONE_QUARTER,NULL 147 148 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS 149 %if ((g_szFddStart-$$) & 0xff00) <> ((g_szFddEnd-$$) & 0xff00) 150 %error "g_szFdd* strings must start on the same 256 byte page, required by the BootMenuPrint_RefreshInformation routines for floppy drives. Please move this block up or down within strings.asm" 151 %endif 152 %endif 153 153 154 154 ;------------------------------------------------------------------------------------------ -
trunk/XTIDE_Universal_BIOS/Src/StringsCompressed.asm
r252 r262 34 34 db 4fh, 4ah, 0cbh, 3eh, 20h, 67h, 0fah, 3eh, 40h, 00h ; compressed 35 35 36 g_szDetectOuterSerial: ; db "Serial %s on %s: ",NULL 37 ; db 53h, 65h, 72h, 69h, 61h, 6ch, 20h, 25h, 73h, 20h, 6fh, 6eh, 20h, 25h, 73h, 3ah, 20h, 00h ; uncompressed 38 db 59h, 6bh, 78h, 6fh, 67h, 0f2h, 3eh, 20h, 75h, 0f4h, 3eh, 40h, 00h ; compressed 39 36 40 g_szDetectPort: ; db "%x",NULL ; IDE Master at 1F0h: 37 41 ; db 25h, 78h, 00h ; uncompressed … … 42 46 db 49h, 55h, 53h, 35h, 1eh ; compressed 43 47 44 g_szDetectCOMAuto: ; db " Auto",NULL45 ; db 20h, 4 1h, 75h, 74h, 6fh, 00h ; uncompressed46 db 20h, 4 7h, 7bh, 7ah, 0b5h ; compressed48 g_szDetectCOMAuto: ; db " Detect",NULL 49 ; db 20h, 44h, 65h, 74h, 65h, 63h, 74h, 00h ; uncompressed 50 db 20h, 4ah, 6bh, 7ah, 6bh, 69h, 0bah ; compressed 47 51 48 52 g_szDetectCOMSmall: ; db "/%u%u00",NULL ; IDE Master at COM1/9600: … … 157 161 158 162 163 g_szAddressingModes: 164 g_szLCHS: ; db "L-CHS",NULL 165 ; db 4ch, 2dh, 43h, 48h, 53h, 00h ; uncompressed 166 db 52h, 28h, 49h, 4eh, 99h ; compressed 167 168 g_szPCHS: ; db "P-CHS",NULL 169 ; db 50h, 2dh, 43h, 48h, 53h, 00h ; uncompressed 170 db 56h, 28h, 49h, 4eh, 99h ; compressed 171 172 g_szLBA28: ; db "LBA28",NULL 173 ; db 4ch, 42h, 41h, 32h, 38h, 00h ; uncompressed 174 db 52h, 48h, 47h, 2ch, 11h ; compressed 175 176 g_szLBA48: ; db "LBA48",NULL 177 ; db 4ch, 42h, 41h, 34h, 38h, 00h ; uncompressed 178 db 52h, 48h, 47h, 2eh, 11h ; compressed 179 180 g_szAddressingModes_Displacement equ (g_szPCHS - g_szAddressingModes) 181 ; 182 ; Ensure that addressing modes are correctly spaced in memory 183 ; 184 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS 185 %if g_szLCHS <> g_szAddressingModes 186 %error "g_szAddressingModes Displacement Incorrect 1" 187 %endif 188 %if g_szPCHS <> g_szLCHS + g_szAddressingModes_Displacement 189 %error "g_szAddressingModes Displacement Incorrect 2" 190 %endif 191 %if g_szLBA28 <> g_szPCHS + g_szAddressingModes_Displacement 192 %error "g_szAddressingModes Displacement Incorrect 3" 193 %endif 194 %if g_szLBA48 <> g_szLBA28 + g_szAddressingModes_Displacement 195 %error "g_szAddressingModes Displacement Incorrect 4" 196 %endif 197 %endif 198 199 g_szBusTypeValues: 200 g_szBusTypeValues_8Dual: ; db "D8 ",NULL 201 ; db 44h, 38h, 20h, 00h ; uncompressed 202 db 4ah, 31h, 00h ; compressed 203 204 g_szBusTypeValues_8Reversed: ; db "X8 ",NULL 205 ; db 58h, 38h, 20h, 00h ; uncompressed 206 db 5eh, 31h, 00h ; compressed 207 208 g_szBusTypeValues_8Single: ; db "S8 ",NULL 209 ; db 53h, 38h, 20h, 00h ; uncompressed 210 db 59h, 31h, 00h ; compressed 211 212 g_szBusTypeValues_16: ; db " 16",NULL 213 ; db 20h, 31h, 36h, 00h ; uncompressed 214 db 20h, 2bh, 10h ; compressed 215 216 g_szBusTypeValues_32: ; db " 32",NULL 217 ; db 20h, 33h, 32h, 00h ; uncompressed 218 db 20h, 2dh, 0ch ; compressed 219 220 g_szBusTypeValues_Serial: ; db "SER",NULL 221 ; db 53h, 45h, 52h, 00h ; uncompressed 222 db 59h, 4bh, 98h ; compressed 223 224 g_szBusTypeValues_Displacement equ (g_szBusTypeValues_8Reversed - g_szBusTypeValues) 225 ; 226 ; Ensure that bus type strings are correctly spaced in memory 227 ; 228 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS 229 %if g_szBusTypeValues_8Dual <> g_szBusTypeValues 230 %error "g_szBusTypeValues Displacement Incorrect 1" 231 %endif 232 %if g_szBusTypeValues_8Reversed <> g_szBusTypeValues + g_szBusTypeValues_Displacement 233 %error "g_szBusTypeValues Displacement Incorrect 2" 234 %endif 235 %if g_szBusTypeValues_8Single <> g_szBusTypeValues_8Reversed + g_szBusTypeValues_Displacement 236 %error "g_szBusTypeValues Displacement Incorrect 3" 237 %endif 238 %if g_szBusTypeValues_16 <> g_szBusTypeValues_8Single + g_szBusTypeValues_Displacement 239 %error "g_szBusTypeValues Displacement Incorrect 4" 240 %endif 241 %if g_szBusTypeValues_32 <> g_szBusTypeValues_16 + g_szBusTypeValues_Displacement 242 %error "g_szBusTypeValues Displacement Incorrect 5" 243 %endif 244 %if g_szBusTypeValues_Serial <> g_szBusTypeValues_32 + g_szBusTypeValues_Displacement 245 %error "g_szBusTypeValues Displacement Incorrect 6" 246 %endif 247 %endif 248 249 g_szSelectionTimeout: ; db DOUBLE_BOTTOM_LEFT_CORNER,DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL,"%ASelection in %2-u s",NULL 250 ; db 0c8h, 0b5h, 25h, 41h, 53h, 65h, 6ch, 65h, 63h, 74h, 69h, 6fh, 6eh, 20h, 69h, 6eh, 20h, 25h, 32h, 2dh, 75h, 20h, 73h, 00h ; uncompressed 251 db 32h, 33h, 3dh, 59h, 6bh, 72h, 6bh, 69h, 7ah, 6fh, 75h, 0f4h, 6fh, 0f4h, 3ch, 20h, 0b9h ; compressed 252 253 254 g_szDashForZero: ; db "- ",NULL 255 ; db 2dh, 20h, 00h ; uncompressed 256 db 28h, 00h ; compressed 257 258 159 259 ; Boot Menu Floppy Disk strings 160 260 ; … … 191 291 %endif 192 292 %endif 193 194 g_szAddressingModes:195 g_szLCHS: ; db "L-CHS",NULL196 ; db 4ch, 2dh, 43h, 48h, 53h, 00h ; uncompressed197 db 52h, 28h, 49h, 4eh, 99h ; compressed198 199 g_szPCHS: ; db "P-CHS",NULL200 ; db 50h, 2dh, 43h, 48h, 53h, 00h ; uncompressed201 db 56h, 28h, 49h, 4eh, 99h ; compressed202 203 g_szLBA28: ; db "LBA28",NULL204 ; db 4ch, 42h, 41h, 32h, 38h, 00h ; uncompressed205 db 52h, 48h, 47h, 2ch, 11h ; compressed206 207 g_szLBA48: ; db "LBA48",NULL208 ; db 4ch, 42h, 41h, 34h, 38h, 00h ; uncompressed209 db 52h, 48h, 47h, 2eh, 11h ; compressed210 211 g_szAddressingModes_Displacement equ (g_szPCHS - g_szAddressingModes)212 ;213 ; Ensure that addressing modes are correctly spaced in memory214 ;215 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS216 %if g_szLCHS <> g_szAddressingModes217 %error "g_szAddressingModes Displacement Incorrect 1"218 %endif219 %if g_szPCHS <> g_szLCHS + g_szAddressingModes_Displacement220 %error "g_szAddressingModes Displacement Incorrect 2"221 %endif222 %if g_szLBA28 <> g_szPCHS + g_szAddressingModes_Displacement223 %error "g_szAddressingModes Displacement Incorrect 3"224 %endif225 %if g_szLBA48 <> g_szLBA28 + g_szAddressingModes_Displacement226 %error "g_szAddressingModes Displacement Incorrect 4"227 %endif228 %endif229 230 g_szBusTypeValues:231 g_szBusTypeValues_8Dual: ; db "D8 ",NULL232 ; db 44h, 38h, 20h, 00h ; uncompressed233 db 4ah, 31h, 00h ; compressed234 235 g_szBusTypeValues_8Reversed: ; db "X8 ",NULL236 ; db 58h, 38h, 20h, 00h ; uncompressed237 db 5eh, 31h, 00h ; compressed238 239 g_szBusTypeValues_8Single: ; db "S8 ",NULL240 ; db 53h, 38h, 20h, 00h ; uncompressed241 db 59h, 31h, 00h ; compressed242 243 g_szBusTypeValues_16: ; db " 16",NULL244 ; db 20h, 31h, 36h, 00h ; uncompressed245 db 20h, 2bh, 10h ; compressed246 247 g_szBusTypeValues_32: ; db " 32",NULL248 ; db 20h, 33h, 32h, 00h ; uncompressed249 db 20h, 2dh, 0ch ; compressed250 251 g_szBusTypeValues_Serial: ; db "SER",NULL252 ; db 53h, 45h, 52h, 00h ; uncompressed253 db 59h, 4bh, 98h ; compressed254 255 g_szBusTypeValues_Displacement equ (g_szBusTypeValues_8Reversed - g_szBusTypeValues)256 ;257 ; Ensure that bus type strings are correctly spaced in memory258 ;259 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS260 %if g_szBusTypeValues_8Dual <> g_szBusTypeValues261 %error "g_szBusTypeValues Displacement Incorrect 1"262 %endif263 %if g_szBusTypeValues_8Reversed <> g_szBusTypeValues + g_szBusTypeValues_Displacement264 %error "g_szBusTypeValues Displacement Incorrect 2"265 %endif266 %if g_szBusTypeValues_8Single <> g_szBusTypeValues_8Reversed + g_szBusTypeValues_Displacement267 %error "g_szBusTypeValues Displacement Incorrect 3"268 %endif269 %if g_szBusTypeValues_16 <> g_szBusTypeValues_8Single + g_szBusTypeValues_Displacement270 %error "g_szBusTypeValues Displacement Incorrect 4"271 %endif272 %if g_szBusTypeValues_32 <> g_szBusTypeValues_16 + g_szBusTypeValues_Displacement273 %error "g_szBusTypeValues Displacement Incorrect 5"274 %endif275 %if g_szBusTypeValues_Serial <> g_szBusTypeValues_32 + g_szBusTypeValues_Displacement276 %error "g_szBusTypeValues Displacement Incorrect 6"277 %endif278 %endif279 280 g_szSelectionTimeout: ; db DOUBLE_BOTTOM_LEFT_CORNER,DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL,"%ASelection in %2-u s",NULL281 ; db 0c8h, 0b5h, 25h, 41h, 53h, 65h, 6ch, 65h, 63h, 74h, 69h, 6fh, 6eh, 20h, 69h, 6eh, 20h, 25h, 32h, 2dh, 75h, 20h, 73h, 00h ; uncompressed282 db 32h, 33h, 3dh, 59h, 6bh, 72h, 6bh, 69h, 7ah, 6fh, 75h, 0f4h, 6fh, 0f4h, 3ch, 20h, 0b9h ; compressed283 284 285 g_szDashForZero: ; db "- ",NULL286 ; db 2dh, 20h, 00h ; uncompressed287 db 28h, 00h ; compressed288 289 290 293 291 294 ;------------------------------------------------------------------------------------------ … … 421 424 ;; translated usage stats 422 425 ;; 33:1 423 ;; 32:3 0426 ;; 32:32 424 427 ;; 181:1 425 428 ;; 53:2 … … 448 451 ;; 5-u:2 449 452 ;; x:7 450 ;; s:1 2453 ;; s:14 451 454 ;; 5-x:1 452 455 ;; nl:6 … … 458 461 459 462 ;; alphabet usage stats 460 ;; 58,:: 2463 ;; 58,::3 461 464 ;; 59,;: 462 465 ;; 60,<: … … 465 468 ;; 63,?: 466 469 ;; 64,@:1 467 ;; 65,A: 4470 ;; 65,A:3 468 471 ;; 66,B:9 469 472 ;; 67,C:4 470 ;; 68,D:1 0473 ;; 68,D:11 471 474 ;; 69,E:3 472 475 ;; 70,F:3 … … 483 486 ;; 81,Q:1 484 487 ;; 82,R:4 485 ;; 83,S: 6488 ;; 83,S:7 486 489 ;; 84,T: 487 490 ;; 85,U:1 … … 497 500 ;; 95,_: 498 501 ;; 96,`: 499 ;; 97,a: 6502 ;; 97,a:7 500 503 ;; 98,b: 501 ;; 99,c: 4504 ;; 99,c:5 502 505 ;; 100,d:4 503 ;; 101,e: 9506 ;; 101,e:12 504 507 ;; 102,f:2 505 508 ;; 103,g:2 506 509 ;; 104,h: 507 ;; 105,i: 9510 ;; 105,i:10 508 511 ;; 106,j: 509 512 ;; 107,k:4 510 ;; 108,l: 4513 ;; 108,l:5 511 514 ;; 109,m:1 512 ;; 110,n: 9515 ;; 110,n:10 513 516 ;; 111,o:18 514 517 ;; 112,p:3 515 518 ;; 113,q: 516 ;; 114,r:1 1519 ;; 114,r:12 517 520 ;; 115,s:6 518 ;; 116,t:1 1519 ;; 117,u: 3521 ;; 116,t:12 522 ;; 117,u:2 520 523 ;; 118,v:2 521 524 ;; 119,w:1 -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm
r258 r262 200 200 call Device_FinalizeDPT 201 201 202 ;---------------------------------------------------------------------- 203 ; Update drive counts (hard and floppy) 204 ;---------------------------------------------------------------------- 205 202 206 %ifdef MODULE_SERIAL_FLOPPY 203 207 ; … … 223 227 %endif 224 228 225 ; Fall to .StoreDriveNumberAndUpdateDriveCount226 227 ;--------------------------------------------------------------------228 ; .StoreDriveNumberAndUpdateDriveCount229 ; Parameters:230 ; DS:DI: Ptr to Disk Parameter Table231 ; ES:SI: Ptr to 512-byte ATA information read from the drive232 ; CS:BP: Ptr to IDEVARS for the controller233 ; ES: BDA Segment234 ; Returns:235 ; DL: Drive number for new drive236 ; CF: Always cleared237 ; Corrupts registers:238 ; Nothing239 ;--------------------------------------------------------------------240 .StoreDriveNumberAndUpdateDriveCount:241 mov dl, [es:BDA.bHDCount]242 or dl, 80h ; Set bit 7 since hard disk243 244 229 inc BYTE [RAMVARS.bDrvCnt] ; Increment drive count to RAMVARS 245 inc BYTE [es:BDA.bHDCount] ; Increment drive count to BDA 246 247 cmp BYTE [RAMVARS.bFirstDrv], 0 ; First drive set? 248 ja SHORT .AllDone ; If so, return 249 mov [RAMVARS.bFirstDrv], dl ; Store first drive number 250 251 .AllDone: 230 231 .AllDone: 252 232 clc 253 233 ret -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm
r259 r262 6 6 7 7 ;-------------------------------------------------------------------- 8 ; Finds pointer to first unused Disk Parameter Table. 9 ; 10 ; FindDPT_ForNewDriveToDSDI 11 ; Parameters: 12 ; DS: RAMVARS segment 13 ; Returns: 14 ; DS:DI: Ptr to first unused DPT 15 ; Corrupts registers: 16 ; DX 17 ;-------------------------------------------------------------------- 18 ALIGN JUMP_ALIGN 19 FindDPT_ForNewDriveToDSDI: 20 mov ax, [RAMVARS.wDrvCntAndFirst] 21 add al, ah 8 ; Checks if drive is handled by this BIOS, and return DPT pointer. 9 ; 10 ; FindDPT_ForDriveNumberInDL 11 ; Parameters: 12 ; DL: Drive number 13 ; DS: RAMVARS segment 14 ; Returns: 15 ; CF: Cleared if drive is handled by this BIOS 16 ; Set if drive belongs to some other BIOS 17 ; DI: DPT Pointer if drive is handled by this BIOS 18 ; Zero if drive belongs to some other BIOS 19 ; Corrupts registers: 20 ; Nothing 21 ;-------------------------------------------------------------------- 22 ALIGN JUMP_ALIGN 23 FindDPT_ForDriveNumberInDL: 24 xchg di, ax ; Save the contents of AX in DI 25 26 ; 27 ; Check Our Hard Disks 28 ; 29 mov ax, [RAMVARS.wDrvCntAndFirst] ; Drive count to AH, First number to AL 30 add ah, al ; One past last drive to AH 31 22 32 %ifdef MODULE_SERIAL_FLOPPY 23 add al, [RAMVARS.xlateVars+XLATEVARS.bFlopCreateCnt] 33 cmp dl, ah ; Above last supported? 34 jae SHORT .HardDiskNotHandledByThisBIOS 35 36 cmp dl, al ; Below first supported? 37 jae SHORT .CalcDPTForDriveNumber 38 39 ALIGN JUMP_ALIGN 40 .HardDiskNotHandledByThisBIOS: 41 ; 42 ; Check Our Floppy Disks 43 ; 44 call RamVars_UnpackFlopCntAndFirstToAL 45 cbw ; normally 0h, could be ffh if no drives present 46 adc ah, al ; if no drives present, still ffh (ffh + ffh + 1 = ffh) 47 js SHORT .DiskIsNotHandledByThisBIOS 48 cmp ah, dl ; Check second drive if two, first drive if only one 49 jz SHORT .CalcDPTForDriveNumber 50 cmp al, dl ; Check first drive in all cases, redundant but OK to repeat 51 jnz SHORT .DiskIsNotHandledByThisBIOS 52 %else 53 cmp dl, ah ; Above last supported? 54 jae SHORT .DiskIsNotHandledByThisBIOS 55 56 cmp dl, al ; Below first supported? 57 jb SHORT .DiskIsNotHandledByThisBIOS 24 58 %endif 25 xchg ax, dx 26 ; fall-through to FindDPT_ForDriveNumber 59 ; fall-through to CalcDPTForDriveNumber 27 60 28 61 ;-------------------------------------------------------------------- 29 62 ; Finds Disk Parameter Table for drive number. 30 ; IDE Base Port address will be stored to RAMVARS if correct DPT is found.31 ; 32 ; FindDPT_ForDriveNumber63 ; Note intended to be called except by FindDPT_ForDriveNumber 64 ; 65 ; CalcDPTForDriveNumber 33 66 ; Parameters: 34 67 ; DL: Drive number 35 68 ; DS: RAMVARS segment 69 ; DI: Saved copy of AX from entry at FindDPT_ForDriveNumber 36 70 ; Returns: 37 71 ; DS:DI: Ptr to DPT 72 ; CF: Clear 38 73 ; Corrupts registers: 39 74 ; Nothing 40 75 ;-------------------------------------------------------------------- 41 76 ALIGN JUMP_ALIGN 42 FindDPT_ForDriveNumber:77 .CalcDPTForDriveNumber: 43 78 push dx 44 xchg di, ax ; Save the contents of AX in DI45 79 46 80 %ifdef MODULE_SERIAL_FLOPPY … … 52 86 call RamVars_UnpackFlopCntAndFirstToAL 53 87 add dl, ah ; add in end of hard disk DPT list, floppies start immediately after 88 89 ALIGN JUMP_ALIGN 54 90 .harddisk: 55 91 sub dl, al ; subtract off beginning of either hard disk or floppy list (as appropriate) … … 57 93 sub dl, [RAMVARS.bFirstDrv] ; subtract off beginning of hard disk list 58 94 %endif 59 95 96 .CalcDPTForNewDrive: 60 97 mov al, LARGEST_DPT_SIZE 61 98 62 99 mul dl 63 add ax, BYTE RAMVARS_size 64 65 xchg di, ax ; Restore AX and put result in DI 100 add ax, BYTE RAMVARS_size ; Clears CF (will not oveflow) 101 66 102 pop dx 67 68 ret 69 70 ;-------------------------------------------------------------------- 71 ; Consolidator for checking the result from RamVars_IsDriveHandledByThisBIOS 72 ; and then if it is our drive, getting the DPT with FindDPT_ForDriveNumber 73 ; 74 ; RamVars_IsDriveHandledByThisBIOS_And_FindDPT_ForDriveNumber 75 ; Parameters: 76 ; DL: Drive number 77 ; DS: RAMVARS segment 78 ; Returns: 79 ; DS:DI: Ptr to DPT, if it is our drive 80 ; CF: Set if not our drive, clear if it is our drive 81 ; Corrupts registers: 82 ; Nothing 83 ;-------------------------------------------------------------------- 84 ALIGN JUMP_ALIGN 85 RamVars_IsDriveHandledByThisBIOS_And_FindDPT_ForDriveNumber: 86 call RamVars_IsDriveHandledByThisBIOS 87 jnc FindDPT_ForDriveNumber 88 ret 89 90 91 ;-------------------------------------------------------------------- 92 ; Finds Disk Parameter Table for 93 ; Master or Slave drive at wanted port. 94 ; 95 ; FindDPT_ToDSDIForIdeMasterAtPortDX 96 ; FindDPT_ToDSDIForIdeSlaveAtPortDX 97 ; Parameters: 98 ; DX: IDE Base Port address 99 ; DS: RAMVARS segment 100 ; Returns: 101 ; DL: Drive number (if DPT found) 102 ; DS:DI: Ptr to DPT 103 ; CF: Set if wanted DPT found 104 ; Cleared if DPT not found 105 ; Corrupts registers: 106 ; SI 107 ; 108 ; Converted to macros since there is only once call site for each of these 109 ; 110 ;-------------------------------------------------------------------- 111 112 %macro FindDPT_ToDSDIForIdeMasterAtPortDX 0 113 mov si, IterateToMasterAtPortCallback 114 call IterateAllDPTs 115 %endmacro 116 117 %macro FindDPT_ToDSDIForIdeSlaveAtPortDX 0 118 mov si, IterateToSlaveAtPortCallback 119 call IterateAllDPTs 120 %endmacro 121 122 123 ;-------------------------------------------------------------------- 124 ; Iteration callback for finding DPT using 125 ; IDE base port for Master or Slave drive. 126 ; 127 ; IterateToSlaveAtPortCallback 128 ; IterateToMasterAtPortCallback 129 ; Parameters: 130 ; DX: IDE Base Port address 131 ; DS:DI: Ptr to DPT to examine 132 ; Returns: 133 ; CF: Set if wanted DPT found 134 ; Cleared if wrong DPT 135 ; Corrupts registers: 136 ; Nothing 137 ;-------------------------------------------------------------------- 138 ALIGN JUMP_ALIGN 139 IterateToSlaveAtPortCallback: 140 test BYTE [di+DPT.bFlagsLow], FLGL_DPT_SLAVE ; Clears CF 141 jnz SHORT CompareBasePortAddress 142 ret ; Wrong DPT 143 144 ALIGN JUMP_ALIGN 145 IterateToMasterAtPortCallback: 146 test BYTE [di+DPT.bFlagsLow], FLGL_DPT_SLAVE 147 jnz SHORT ReturnWrongDPT ; Return if slave drive 148 149 CompareBasePortAddress: 150 push bx 151 eMOVZX bx, BYTE [di+DPT.bIdevarsOffset] ; CS:BX now points to IDEVARS 152 cmp dx, [cs:bx+IDEVARS.wPort] ; Wanted port? 153 pop bx 154 jne SHORT ReturnWrongDPT 155 156 ReturnRightDPT: 157 stc ; Set CF since wanted DPT 158 ret 159 103 104 xchg di, ax ; Restore AX from entry at FindDPT_ForDriveNumber, put DPT pointer in DI 105 ret 106 107 ALIGN JUMP_ALIGN 108 .DiskIsNotHandledByThisBIOS: 109 ; 110 ; Drive not found... 111 ; 112 xor ax, ax ; Clear DPT pointer 113 stc ; Is not supported by our BIOS 114 115 xchg di, ax ; Restore AX from save at top 116 ret 117 118 ;-------------------------------------------------------------------- 119 ; Finds pointer to first unused Disk Parameter Table. 120 ; Should only be used before DetectDrives is complete (not valid after this time). 121 ; 122 ; FindDPT_ForNewDriveToDSDI 123 ; Parameters: 124 ; DS: RAMVARS segment 125 ; Returns: 126 ; DS:DI: Ptr to first unused DPT 127 ; Corrupts registers: 128 ; AX 129 ;-------------------------------------------------------------------- 130 ALIGN JUMP_ALIGN 131 FindDPT_ForNewDriveToDSDI: 132 push dx 133 134 %ifdef MODULE_SERIAL_FLOPPY 135 mov dx, [RAMVARS.wDrvCntAndFlopCnt] 136 add dl, dh 137 %else 138 mov dl, [RAMVARS.bDrvCnt] 139 %endif 140 141 jmp short FindDPT_ForDriveNumberInDL.CalcDPTForNewDrive 160 142 161 143 ;-------------------------------------------------------------------- … … 165 147 ; BL: Bit(s) to test in DPT.bFlagsHigh 166 148 ; Returns: 167 ; CF: Setif wanted DPT found168 ; Clearedif wrong DPT149 ; CF: Clear if wanted DPT found 150 ; Set if wrong DPT 169 151 ; Corrupts registers: 170 152 ; Nothing … … 172 154 ALIGN JUMP_ALIGN 173 155 IterateToDptWithFlagsHighInBL: 174 test BYTE [di+DPT.bFlagsHigh], bl ; Clears CF (but we need the clc 175 ; below anyway for callers above) 176 jnz SHORT ReturnRightDPT 177 178 ReturnWrongDPT: 179 clc ; Clear CF since wrong DPT 156 test BYTE [di+DPT.bFlagsHigh], bl ; Clears CF 157 jnz SHORT .ReturnRightDPT 158 stc 159 .ReturnRightDPT: 180 160 ret 181 161 … … 220 200 ; AX,BX,DX: Parameters to callback function 221 201 ; CS:SI: Ptr to callback function 202 ; Callback routine should return CF=clear if found 222 203 ; DS: RAMVARS segment 223 204 ; Returns: 224 205 ; DS:DI: Ptr to wanted DPT (if found) 225 206 ; If not found, points to first empty DPT 226 ; CF: Setif wanted DPT found227 ; Clearedif DPT not found, or no DPTs present207 ; CF: Clear if wanted DPT found 208 ; Set if DPT not found, or no DPTs present 228 209 ; Corrupts registers: 229 210 ; Nothing unless corrupted by callback function … … 238 219 xor ch, ch ; Clears CF 239 220 240 jcxz . AllDptsIterated ; Return if no drives, CF will be clear from xor above221 jcxz .NotFound ; Return if no drives 241 222 242 223 ALIGN JUMP_ALIGN 243 224 .LoopWhileDPTsLeft: 244 225 call si ; Is wanted DPT? 245 j c SHORT .AllDptsIterated; If so, return246 add di, BYTE LARGEST_DPT_SIZE ; Point to next DPT , clears CF226 jnc SHORT .Found ; If so, return 227 add di, BYTE LARGEST_DPT_SIZE ; Point to next DPT 247 228 loop .LoopWhileDPTsLeft 248 249 ; fall-through: DPT was not found, CF is already clear from ADD di inside the loop 250 251 ALIGN JUMP_ALIGN 252 .AllDptsIterated: 229 230 ALIGN JUMP_ALIGN 231 .NotFound: 232 stc 233 234 ALIGN JUMP_ALIGN 235 .Found: 253 236 pop cx 254 237 ret -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm
r258 r262 115 115 116 116 ;-------------------------------------------------------------------- 117 ; Checks if INT 13h function is handled by this BIOS.118 ;119 ; RamVars_IsFunctionHandledByThisBIOS120 ; Parameters:121 ; AH: INT 13h function number122 ; DL: Drive number123 ; DS: RAMVARS segment124 ; Returns:125 ; CF: Cleared if function is handled by this BIOS126 ; Set if function belongs to some other BIOS127 ; Corrupts registers:128 ; Nothing129 ;--------------------------------------------------------------------130 ALIGN JUMP_ALIGN131 RamVars_IsFunctionHandledByThisBIOS:132 test ah, ah ; Reset for all floppy and hard disk drives?133 jz SHORT RamVars_IsDriveHandledByThisBIOS.CFAlreadyClear_IsHandledByOurBIOS134 cmp ah, 08h135 %ifdef MODULE_SERIAL_FLOPPY136 ; we handle all traffic for function 08h, as we need to wrap both hard disk and floppy drive counts137 je SHORT RamVars_IsDriveHandledByThisBIOS.CFAlreadyClear_IsHandledByOurBIOS138 %else139 ; we handle all *hard disk* traffic for function 08h, as we need to wrap the hard disk drive count140 je SHORT RamVars_IsDriveHandledByThisBIOS.IsDriveAHardDisk141 %endif142 ;;; fall-through143 144 ;--------------------------------------------------------------------145 ; Checks if drive is handled by this BIOS.146 ;147 ; RamVars_IsDriveHandledByThisBIOS148 ; Parameters:149 ; DL: Drive number150 ; DS: RAMVARS segment151 ; Returns:152 ; CF: Cleared if drive is handled by this BIOS153 ; Set if drive belongs to some other BIOS154 ; Corrupts registers:155 ; Nothing156 ;--------------------------------------------------------------------157 ALIGN JUMP_ALIGN158 RamVars_IsDriveHandledByThisBIOS:159 push ax160 161 mov ax, [RAMVARS.wDrvCntAndFirst] ; Drive count to AH, First number to AL162 add ah, al ; One past last drive to AH163 cmp dl, ah ; Above last supported?164 jae SHORT .HardDiskIsNotHandledByThisBIOS165 .TestLowLimit:166 cmp dl, al ; Below first supported?167 jae SHORT .CFAlreadyClear_IsHandledByOurBIOS_PopAX ; note that CF is clear if the branch is taken168 169 .HardDiskIsNotHandledByThisBIOS:170 %ifdef MODULE_SERIAL_FLOPPY171 call RamVars_UnpackFlopCntAndFirstToAL172 cbw ; normally 0h, could be ffh if no drives present173 adc ah, al ; if no drives present, still ffh (ffh + ffh + 1 = ffh)174 js SHORT .DiskIsNotHandledByThisBIOS175 cmp ah, dl176 jz SHORT .CFAlreadyClear_IsHandledByOurBIOS_PopAX177 cmp al, dl178 jz SHORT .CFAlreadyClear_IsHandledByOurBIOS_PopAX179 .DiskIsNotHandledByThisBIOS:180 %endif181 182 stc ; Is not supported by our BIOS183 184 .CFAlreadyClear_IsHandledByOurBIOS_PopAX:185 pop ax186 .CFAlreadyClear_IsHandledByOurBIOS:187 ret188 189 %ifndef MODULE_SERIAL_FLOPPY190 ;191 ; Note that we could have just checked for the high order bit in dl, but with the needed STC and jumps,192 ; leveraging the code above resulted in space savings.193 ;194 .IsDriveAHardDisk:195 push ax ; match stack at the top of routine196 mov al, 80h ; to catch all hard disks, lower limit is 80h vs. bFirstDrv197 jmp .TestLowLimit ; and there is no need to test a high limit198 %endif199 200 ;--------------------------------------------------------------------201 117 ; RamVars_GetHardDiskCountFromBDAtoAX 202 118 ; Parameters:
Note:
See TracChangeset
for help on using the changeset viewer.