Changeset 294 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs
- Timestamp:
- Mar 4, 2012, 1:35:10 AM (13 years ago)
- google:author:
- krille_n_@hotmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
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.