Changeset 258 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm
- Timestamp:
- Feb 22, 2012, 7:01:53 PM (13 years ago)
- google:author:
- gregli@hotmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm
r241 r258 123 123 ; DS: RAMVARS segment 124 124 ; Returns: 125 ; CF: Setif function is handled by this BIOS126 ; Clearedif function belongs to some other BIOS125 ; CF: Cleared if function is handled by this BIOS 126 ; Set if function belongs to some other BIOS 127 127 ; Corrupts registers: 128 128 ; Nothing … … 131 131 RamVars_IsFunctionHandledByThisBIOS: 132 132 test ah, ah ; Reset for all floppy and hard disk drives? 133 jz SHORT .FunctionIsHandledByOurBIOS134 cmp ah, 08h ; Read Disk Drive Parameters?135 jne SHORT RamVars_IsDriveHandledByThisBIOS 136 test dl, dl ; We do not handle floppy drives137 j ns SHORT .FunctionIsNotHandledByOurBIOS138 ALIGN JUMP_ALIGN 139 .FunctionIsHandledByOurBIOS: 140 stc141 .FunctionIsNotHandledByOurBIOS: 142 ret 143 133 jz SHORT RamVars_IsDriveHandledByThisBIOS.CFAlreadyClear_IsHandledByOurBIOS 134 cmp ah, 08h 135 %ifdef MODULE_SERIAL_FLOPPY 136 ; we handle all traffic for function 08h, as we need to wrap both hard disk and floppy drive counts 137 je SHORT RamVars_IsDriveHandledByThisBIOS.CFAlreadyClear_IsHandledByOurBIOS 138 %else 139 ; we handle all *hard disk* traffic for function 08h, as we need to wrap the hard disk drive count 140 je SHORT RamVars_IsDriveHandledByThisBIOS.IsDriveAHardDisk 141 %endif 142 ;;; fall-through 143 144 144 ;-------------------------------------------------------------------- 145 145 ; Checks if drive is handled by this BIOS. … … 150 150 ; DS: RAMVARS segment 151 151 ; Returns: 152 ; CF: Setif drive is handled by this BIOS153 ; Clearedif drive belongs to some other BIOS152 ; CF: Cleared if drive is handled by this BIOS 153 ; Set if drive belongs to some other BIOS 154 154 ; Corrupts registers: 155 155 ; Nothing … … 158 158 RamVars_IsDriveHandledByThisBIOS: 159 159 push ax 160 mov ax, [RAMVARS.wDrvCntAndFirst] ; Drive count to AL, First number to AH 161 add al, ah ; One past last drive to AL 162 cmp dl, al ; Above last supported? 163 jae SHORT .DriveNotHandledByThisBIOS 164 cmp ah, dl ; Below first supported? 165 ja SHORT .DriveNotHandledByThisBIOS 166 stc 167 .DriveNotHandledByThisBIOS: 160 161 mov ax, [RAMVARS.wDrvCntAndFirst] ; Drive count to AH, First number to AL 162 add ah, al ; One past last drive to AH 163 cmp dl, ah ; Above last supported? 164 jae SHORT .HardDiskIsNotHandledByThisBIOS 165 .TestLowLimit: 166 cmp dl, al ; Below first supported? 167 jae SHORT .CFAlreadyClear_IsHandledByOurBIOS_PopAX ; note that CF is clear if the branch is taken 168 169 .HardDiskIsNotHandledByThisBIOS: 170 %ifdef MODULE_SERIAL_FLOPPY 171 call RamVars_UnpackFlopCntAndFirstToAL 172 cbw ; normally 0h, could be ffh if no drives present 173 adc ah, al ; if no drives present, still ffh (ffh + ffh + 1 = ffh) 174 js SHORT .DiskIsNotHandledByThisBIOS 175 cmp ah, dl 176 jz SHORT .CFAlreadyClear_IsHandledByOurBIOS_PopAX 177 cmp al, dl 178 jz SHORT .CFAlreadyClear_IsHandledByOurBIOS_PopAX 179 .DiskIsNotHandledByThisBIOS: 180 %endif 181 182 stc ; Is not supported by our BIOS 183 184 .CFAlreadyClear_IsHandledByOurBIOS_PopAX: 168 185 pop ax 169 ret 170 171 172 ;-------------------------------------------------------------------- 173 ; RamVars_GetHardDiskCountFromBDAtoCX 174 ; Parameters: 175 ; DS: RAMVARS segment 176 ; Returns: 177 ; CX: Total hard disk count 178 ; Corrupts registers: 179 ; Nothing 180 ;-------------------------------------------------------------------- 181 ALIGN JUMP_ALIGN 182 RamVars_GetHardDiskCountFromBDAtoCX: 186 .CFAlreadyClear_IsHandledByOurBIOS: 187 ret 188 189 %ifndef MODULE_SERIAL_FLOPPY 190 ; 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 routine 196 mov al, 80h ; to catch all hard disks, lower limit is 80h vs. bFirstDrv 197 jmp .TestLowLimit ; and there is no need to test a high limit 198 %endif 199 200 ;-------------------------------------------------------------------- 201 ; RamVars_GetHardDiskCountFromBDAtoAX 202 ; Parameters: 203 ; DS: RAMVARS segment 204 ; Returns: 205 ; AX: Total hard disk count 206 ; Corrupts registers: 207 ; CX 208 ;-------------------------------------------------------------------- 209 ALIGN JUMP_ALIGN 210 RamVars_GetHardDiskCountFromBDAtoAX: 183 211 push es 184 push dx 185 186 LOAD_BDA_SEGMENT_TO es, cx, ! ; Zero CX 187 call RamVars_GetCountOfKnownDrivesToDL 212 213 LOAD_BDA_SEGMENT_TO es, ax 214 call RamVars_GetCountOfKnownDrivesToAX 188 215 mov cl, [es:BDA.bHDCount] 189 MAX_U cl, dl 190 191 pop dx 216 MAX_U al, cl 217 192 218 pop es 193 219 ret 194 220 195 221 ;-------------------------------------------------------------------- 196 ; RamVars_GetCountOfKnownDrivesTo DL197 ; Parameters: 198 ; DS: RAMVARS segment 199 ; Returns: 200 ; DL: Total hard disk count201 ; Corrupts registers: 202 ; No thing203 ;-------------------------------------------------------------------- 204 ALIGN JUMP_ALIGN 205 RamVars_GetCountOfKnownDrivesTo DL:206 mov dl, [RAMVARS.bFirstDrv] ; Number for our first drive207 add dl, [RAMVARS.bDrvCnt] ; Our drives208 and dl, 7Fh ; Clear HD bit for drive count209 ret210 211 222 ; RamVars_GetCountOfKnownDrivesToAX 223 ; Parameters: 224 ; DS: RAMVARS segment 225 ; Returns: 226 ; AX: Total hard disk count 227 ; Corrupts registers: 228 ; None 229 ;-------------------------------------------------------------------- 230 ALIGN JUMP_ALIGN 231 RamVars_GetCountOfKnownDrivesToAX: 232 mov ax, [RAMVARS.wDrvCntAndFirst] 233 add al, ah 234 and al, 7fh 235 cbw 236 ret 237 212 238 ;-------------------------------------------------------------------- 213 239 ; RamVars_GetIdeControllerCountToCX … … 219 245 ; Nothing 220 246 ;-------------------------------------------------------------------- 247 ALIGN JUMP_ALIGN 221 248 RamVars_GetIdeControllerCountToCX: 222 249 eMOVZX cx, BYTE [cs:ROMVARS.bIdeCnt] 223 250 ret 251 252 %ifdef MODULE_SERIAL_FLOPPY 253 ;-------------------------------------------------------------------- 254 ; RamVars_UnpackFlopCntAndFirstToAL 255 ; Parameters: 256 ; Nothing 257 ; Returns: 258 ; AL: First floppy drive number supported 259 ; CF: Number of floppy drives supported (clear = 1, set = 2) 260 ; Corrupts registers: 261 ; Nothing 262 ;-------------------------------------------------------------------- 263 ALIGN JUMP_ALIGN 264 RamVars_UnpackFlopCntAndFirstToAL: 265 mov al, [RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst] 266 sar al, 1 267 ret 268 %endif
Note:
See TracChangeset
for help on using the changeset viewer.