Changeset 258 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.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/FindDPT.asm
r233 r258 14 14 ; DS:DI: Ptr to first unused DPT 15 15 ; Corrupts registers: 16 ; D L16 ; DX 17 17 ;-------------------------------------------------------------------- 18 18 ALIGN JUMP_ALIGN 19 19 FindDPT_ForNewDriveToDSDI: 20 mov dl, [RAMVARS.bFirstDrv] 21 add dl, [RAMVARS.bDrvCnt] 20 mov ax, [RAMVARS.wDrvCntAndFirst] 21 add al, ah 22 %ifdef MODULE_SERIAL_FLOPPY 23 add al, [RAMVARS.xlateVars+XLATEVARS.bFlopCreateCnt] 24 %endif 25 xchg ax, dx 22 26 ; Fall to FindDPT_ForDriveNumber 23 27 … … 41 45 xchg di, ax ; Save the contents of AX in DI 42 46 47 %ifdef MODULE_SERIAL_FLOPPY 48 mov ax, [RAMVARS.wDrvCntAndFirst] 49 50 test dl, dl 51 js .harddisk 52 53 call RamVars_UnpackFlopCntAndFirstToAL 54 add dl, ah ; add in end of hard disk DPT list, floppies start immediately after 55 .harddisk: 56 sub dl, al ; subtract off beginning of either hard disk or floppy list (as appropriate) 57 %else 58 sub dl, [RAMVARS.bFirstDrv] ; subtract off beginning of hard disk list 59 %endif 60 43 61 mov al, LARGEST_DPT_SIZE 44 sub dl, [RAMVARS.bFirstDrv]62 45 63 mul dl 46 64 add ax, BYTE RAMVARS_size 47 65 48 xchg di, ax ; Restore AX and put result in DI66 xchg di, ax ; Restore AX and put result in DI 49 67 pop dx 50 68 ret … … 89 107 ; IterateToMasterAtPortCallback 90 108 ; Parameters: 91 ; CH: Drive number92 109 ; DX: IDE Base Port address 93 110 ; DS:DI: Ptr to DPT to examine 94 111 ; Returns: 95 ; DL: Drive number if correct DPT96 112 ; CF: Set if wanted DPT found 97 113 ; Cleared if wrong DPT … … 116 132 pop bx 117 133 jne SHORT ReturnWrongDPT 118 mov dl, ch ; Return drive number in DL119 134 120 135 ReturnRightDPT: … … 187 202 ; Returns: 188 203 ; DS:DI: Ptr to wanted DPT (if found) 204 ; If not found, points to first empty DPT 189 205 ; CF: Set if wanted DPT found 190 206 ; Cleared if DPT not found, or no DPTs present … … 195 211 IterateAllDPTs: 196 212 push cx 197 mov cx, [RAMVARS.wDrvCntAndFirst] 213 214 mov cl, [RAMVARS.bDrvCnt] 215 mov ch, 0 216 217 mov di, RAMVARS_size ; Point DS:DI to first DPT 218 198 219 jcxz .NotFound ; Return if no drives 199 mov di, RAMVARS_size ; Point DS:DI to first DPT220 200 221 ALIGN JUMP_ALIGN 201 222 .LoopWhileDPTsLeft: 202 223 call si ; Is wanted DPT? 203 224 jc SHORT .AllDptsIterated ; If so, return 204 inc ch ; Increment drive number205 225 add di, BYTE LARGEST_DPT_SIZE ; Point to next DPT 206 dec cl ; Decrement drives left207 jnz SHORT .LoopWhileDPTsLeft226 loop .LoopWhileDPTsLeft 227 208 228 .NotFound: 209 229 clc ; Clear CF since DPT not found 230 210 231 ALIGN JUMP_ALIGN 211 232 .AllDptsIterated:
Note:
See TracChangeset
for help on using the changeset viewer.