Ignore:
Timestamp:
Feb 14, 2019, 7:38:08 PM (5 years ago)
Author:
krille_n_
Message:

Changes:

  • Building the BIOS now works again.
  • Added a new IDE device type/transfer mode for use only with XT-IDE rev 2+ (or Chuck(G)-modded rev 1) cards installed in any of the following machines: Olivetti M24, AT&T PC6300, Xerox 6060 and Logabax Persona 1600. This new transfer mode is slightly faster than the regular XT-IDE rev 1 device type and requires that the card is configured for High Speed mode (or, in case of the card being a rev 1 card, has the Chuck(G) mod done). The new device type is called "XTIDE rev 2 (Olivetti M24)" in XTIDECFG.
  • Made some minor improvements to the library code that handles 'Drive Not Ready' errors in XTIDECFG.
  • Optimizations.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm

    r599 r601  
    9898; Here we might want to replace BIOS configured drives with the ones we detected.
    9999; Primary reason is to support dynamic overlay feature in the future. Second reason
    100 ; is a hack to get Windows 95 load proper IDE drivers.
     100; is a hack to get Windows 95 to load its built-in protected mode IDE driver.
    101101;
    102102; The Windows hack has two parts. First part is to try to alter CMOS address 12h as that
     
    109109
    110110%ifdef USE_AT   ; FLG_ROMVARS_IGNORE_MOTHERBOARD_DRIVES is for AT builds only
    111 
    112     %ifdef MODULE_WIN95_CMOS_HACK
    113         mov     dl, HARD_DISK_TYPES
    114         call    CMOS_ReadFromIndexInDLtoAL
    115         test    al, 0F0h
    116         jnz     SHORT .ClearBdaDriveCount       ; CMOS byte 12h is ready for Windows 95
    117         call    CMOS_Verify10hTo2Dh             ; Can we modify CMOS?
    118         jnz     SHORT .ClearBdaDriveCount       ; Unsupported BIOS, use plan B
    119 
    120         ; Now we can alter CMOS location 12h. Award BIOS locks if we set drive 0 type to Fh
    121         ; (but accept changes to drive type 1). Windows 95 requires that the drive 0 type is
    122         ; non zero and ignores drive 1 type. So if we only set drive 1, then Award BIOS
    123         ; won't give problems but Windows 95 stays in MS-DOS compatibility mode.
    124         ;
    125         ; For Award BIOSes we could set the Drive 0 type to 1 and then clear the BDA drive count.
    126         ; So essentially we could automatically do what user needs to do manually to get Windows 95
    127         ; working on Award BIOSes. However, I think that should be left to do manually since
    128         ; there may be SCSI drives on the system or FLG_ROMVARS_IGNORE_MOTHERBOARD_DRIVES could
    129         ; be intentionally cleared and forcing the dummy drive might cause only trouble.
    130 
    131         ; Try to detect Award BIOS (Seems to work on a tested 128k BIOS so hopefully
    132         ; there will be no need to scan E000h segment)
    133         mov     cx, 65536 - 4
    134         mov     eax, 'Awar'     ; Four characters should be enough
    135         mov     di, 0F000h      ; Scan 64k starting from segment F000h
    136         mov     fs, di          ; No need to preserve FS since we set it to zero soon when we boot
    137         xor     di, di
    138     .ScanNextCharacters:
    139         cmp     [fs:di], eax
    140         je      SHORT .ClearBdaDriveCount   ; Award detected, cannot modify CMOS
    141         inc     di              ; Increment offset by one character (not four)
    142         loop    .ScanNextCharacters
    143 
    144         ; Now it should be safe to write
    145         mov     dl, HARD_DISK_TYPES
    146         mov     al, 0F0h    ; Drive 0 type 16...47 (supposed to be defined elsewhere in the CMOS)
    147         call    CMOS_WriteALtoIndexInDL
    148         call    CMOS_StoreNewChecksumFor10hto2Dh
     111%ifdef MODULE_WIN95_CMOS_HACK
     112    mov     dl, HARD_DISK_TYPES
     113    call    CMOS_ReadFromIndexInDLtoAL
     114    test    al, 0F0h
     115    jnz     SHORT .ClearBdaDriveCount       ; CMOS byte 12h is ready for Windows 95
     116    call    CMOS_Verify10hTo2Dh             ; Can we modify CMOS?
     117    jnz     SHORT .ClearBdaDriveCount       ; Unsupported BIOS, use plan B
     118
     119    ; Now we can alter CMOS location 12h. Award BIOS locks if we set drive 0 type to Fh
     120    ; (but accept changes to drive type 1). Windows 95 requires that the drive 0 type is
     121    ; non zero and ignores drive 1 type. So if we only set drive 1, then Award BIOS
     122    ; won't give problems but Windows 95 stays in MS-DOS compatibility mode.
     123    ;
     124    ; For Award BIOSes we could set the Drive 0 type to 1 and then clear the BDA drive count.
     125    ; So essentially we could automatically do what user needs to do manually to get Windows 95
     126    ; working on Award BIOSes. However, I think that should be left to do manually since
     127    ; there may be SCSI drives on the system or FLG_ROMVARS_IGNORE_MOTHERBOARD_DRIVES could
     128    ; be intentionally cleared and forcing the dummy drive might cause only trouble.
     129
     130    ; Try to detect Award BIOS (Seems to work on a tested 128k BIOS so hopefully
     131    ; there will be no need to scan E000h segment)
     132    mov     cx, 65536 - 4
     133    mov     eax, 'Awar'                     ; Four characters should be enough
     134    mov     di, 0F000h                      ; Scan 64k starting from segment F000h
     135    mov     fs, di                          ; No need to preserve FS since we set it to zero soon when we boot
     136    xor     di, di
     137.ScanNextCharacters:
     138    cmp     [fs:di], eax
     139    je      SHORT .ClearBdaDriveCount       ; Award detected, cannot modify CMOS
     140    inc     di                              ; Increment offset by one character (not four)
     141    loop    .ScanNextCharacters
     142
     143    ; Now it should be safe to write
     144    mov     dl, HARD_DISK_TYPES
     145    mov     al, 0F0h                        ; Drive 0 type 16...47 (supposed to be defined elsewhere in the CMOS)
     146    call    CMOS_WriteALtoIndexInDL
     147    call    CMOS_StoreNewChecksumFor10hto2Dh
    149148.ClearBdaDriveCount:
    150     %endif  ; MODULE_WIN95_CMOS_HACK
     149%endif ; MODULE_WIN95_CMOS_HACK
    151150
    152151    test    BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_IGNORE_MOTHERBOARD_DRIVES
    153152    jz      SHORT .ContinueInitialization
    154     mov     BYTE [es:BDA.bHDCount], 0   ; Set hard disk count to zero
     153    mov     BYTE [es:BDA.bHDCount], 0       ; Set hard disk count to zero
    155154.ContinueInitialization:
    156 %endif
    157 
    158     mov     cx, [RAMVARS.wDrvCntAndFlopCnt]     ; Our count of hard disks
     155%endif ; USE_AT
     156
     157    mov     cx, [RAMVARS.wDrvCntAndFlopCnt] ; Our count of hard disks
    159158    mov     al, [es:BDA.bHDCount]
    160     add     [es:BDA.bHDCount], cl       ; Add our drives to the system count
    161     or      al, 80h                     ; Or in hard disk flag
    162     mov     [RAMVARS.bFirstDrv], al     ; Store first drive number
     159    add     [es:BDA.bHDCount], cl           ; Add our drives to the system count
     160    or      al, 80h                         ; Or in hard disk flag
     161    mov     [RAMVARS.bFirstDrv], al         ; Store first drive number
    163162
    164163.AddFloppies:
     
    170169    dec     ch
    171170    mov     al, ch
    172     js      .NoFloppies                     ; if no drives are present, we store 0ffh
     171    js      SHORT .NoFloppies               ; If no drives are present, we store 0FFh
    173172
    174173    call    FloppyDrive_GetCountFromBIOS_or_BDA
     
    242241;--------------------------------------------------------------------
    243242.ReadAtaInfoFromHardDisk:
    244     mov     si, BOOTVARS.rgbAtaInfo     ; ES:SI now points to ATA info location
     243    mov     si, BOOTVARS.rgbAtaInfo         ; ES:SI now points to ATA info location
    245244    push    es
    246245    push    si
     
    255254    ; Fall to .ReadAtapiInfoFromDrive
    256255
    257 .ReadAtapiInfoFromDrive:                ; Not yet implemented
    258     ;call   ReadAtapiInfoFromDrive      ; Assume CD-ROM
     256.ReadAtapiInfoFromDrive:                    ; Not yet implemented
     257    ;call   ReadAtapiInfoFromDrive          ; Assume CD-ROM
    259258    ;jnc    SHORT _CreateBiosTablesForCDROM
    260259
Note: See TracChangeset for help on using the changeset viewer.