Changeset 171 for trunk/bootcode/regular/partscan.asm
- Timestamp:
- Apr 8, 2017, 12:28:09 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bootcode/regular/partscan.asm
r164 r171 31 31 32 32 IFDEF AUX_DEBUG 33 IF 033 IF 1 34 34 DBG_TEXT_OUT_AUX 'PARTSCAN_ScanForPartitions:' 35 35 PUSHRF … … 48 48 mov [NewPartitions], al 49 49 50 mov byte ptr [CurIO_Scanning], 1 51 mov dl, 80h ; is first harddisc50 mov byte ptr [CurIO_Scanning], 1 ; Set flag due scanning partitions 51 mov dl, 80h ; Is first harddisc 52 52 PSSFP_HarddiscLoop: 53 53 54 55 54 56 ; ========================================================= [ Scan Partitions ] 55 57 58 59 ; Save BIOS disk number 56 60 push dx 61 62 ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 63 ;!! THIS IS WHERE WE TRY TO DETECT LARGE FLOPPIES ! 64 ;!! --------------------------------------------------------------- 65 ;!! This is a quick hack to ignore LARGE FLOPPY removable media. 66 ;!! With LARGE FLOPPY, the boot record will be a BPB instead of 67 ;!! an MBR. To distinguish, it is assumed that the MBR bootable 68 ;!! flag is either 00h or 80h. LARGE FLOPPIES will often have 69 ;!! other values there. So, the block below tests if all 4 entries 70 ;!! result in 0 when first ored together and then anded with 7fh. 71 ;!! 72 ;!! THIS IS NOT BULLET PROOF AND WILL BE ENHANCED IN THE FUTURE 73 ;!! 74 ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 75 76 ; Push the whole shebang 77 pusha 78 79 ; Check if this is a removable drive 80 call DriveIO_CalcDiskInfoPointer ; Pointer to DISKINFO 81 mov ax, [bx+LocDISKINFO_I13X_Flags] ; Get INT13X flags 82 test ax, 04h ; Bit 3=1 if removable 83 clc ; Assume fixed 84 85 ; Fixed drive, so skip further checking for LARGE FLOPPY. 86 ; We *DO* halt on broken partition tables ! 87 ; This is needed because AiR-BOOT cannot continue with broken 88 ; tables on truly partitioned disks. 89 je @F 90 91 92 ; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 93 ; !! THE DISK IS A REMOVABLE ! 94 ; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 95 96 97 IFDEF AUX_DEBUG 98 IF 0 99 DBG_TEXT_OUT_AUX 'test bigflop' 100 PUSHRF 101 ;~ call DEBUG_DumpRegisters 102 ;~ call AuxIO_DumpParagraph 103 ;~ call AuxIO_TeletypeNL 104 POPRF 105 ENDIF 106 ENDIF 107 108 ; If it has LVM info, it must be partitioned and thus OK 109 mov al, [bx+LocDISKINFO_LVM_Secs] ; Get LVM_SPT 110 test al, al ; See if 0 111 clc ; Assume OK 112 jne @F ; LVM_SPT present, OK 113 114 ; Now load its boot sector and see if AiR-BOOT is there, if so, OK 115 mov si, offset [Scratch] ; Pointer to sector buffer 116 call DriveIO_LoadMBR ; Load it 117 test al, 08h ; AiR-BOOT signature found ? 118 clc ; Assume OK 119 jne @F ; AB found, must be partitioned 120 121 ; A zero sector is also OK -- ready to be partitioned by OS/2 ;) 122 call IsSectorBufferZero ; check if sector is all zeros 123 clc ; Assume OK 124 je @F ; Zero sector, OK 125 126 ; !! NOW WE TEST MBR BOOT FLAGS. 127 ; !! MOST LARGE FLOPPIES WILL HAVE DATA THERE. 128 ; !! NOT BULLET PROOF, NEEDS TO BE IMPROVED. 129 xor ax, ax ; Clear for oring and anding 130 add si, 01beh ; Advance to partition table 131 mov cx, 4 ; Four entries to test 132 cld ; Load upwards 133 __nxt: 134 lodsb ; Load Boot Flag (00h OR 80h) 135 or ah, al ; Merge all bits to AH 136 add si, 16 ; Point to next entry 137 loop __nxt ; Again if still entries to test 138 139 ; A LARGE FLOPPY with 00h or 80h bytes at these 4 locations 140 ; will PASS !! 141 and ah, 7fh ; Strip of potential Boot Flag 142 clc ; Assume OK 143 jz @F ; Good indication this is NOT a BPB, but... 144 145 146 ;!! The Boot Flag bytes were NOT either 00h or 80h, so this is 147 ;!! definintly not a partitioned disk. 148 ;!! SET CY TO INDICATE SKIPPING 'PARTSCAN_ScanDriveForPartitions' 149 stc 150 151 ; End of LARGE FLOPPY test 152 @@: 153 154 ; Restore the whole shebang 155 popa 156 157 ; CARRY IS SET, LARGE FLOPPY OR WHAT -- SKIP IT !! 158 jc @F 159 160 ; This disk should be partitioned, so scan it. 161 ; Broken partitions *DOS* halt AiR-BOOT ! 57 162 call PARTSCAN_ScanDriveForPartitions 163 164 @@: 165 166 58 167 pop dx 59 168 inc dl
Note:
See TracChangeset
for help on using the changeset viewer.