Changeset 593 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Inc


Ignore:
Timestamp:
Jun 30, 2018, 8:27:04 AM (6 years ago)
Author:
aitotat
Message:

Flashing now works again.
Hack to get Windows 95 to work properly (MODULE_WIN95_CMOS_HACK included for 386 builds by default).
Edited makefile to produce large 386 build.
Fixed recovery time for QDI Vision VLB-IDE controllers.
No more warnings with Nasm 2.13.xx and later.
File dialog now properly restores default drive when file selection is cancelled.

Location:
trunk/XTIDE_Universal_BIOS/Inc
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Inc/ATA_ID.inc

    r567 r593  
    5656PIO_6_MIN_ACTIVE_TIME_NS    EQU     55
    5757
    58 ; PIO Minimum Recovery Times or Inactive Times (t2i) can be calculated
    59 ; from Minimum Cycle Time (t0) - Minimum Active Time (t2) - Address Valid Time (t1).
    60 ; I'm not sure about this calculation so correct me if I'm wrong!
    61 ; Recovery time should be calculated at run time since Cycle Time t0 can be
    62 ; read from ATA information (ATA2+) but most drives just report the
    63 ; Min Cycle Times listed above.
    64 
     58; PIO 0...2 Maximum Addr valid to IOCS16- released (t8)
     59PIO_0_MAX_ADDR_VALID_TO_IOCS16_RELEASED     EQU     60
     60PIO_1_MAX_ADDR_VALID_TO_IOCS16_RELEASED     EQU     45
     61PIO_2_MAX_ADDR_VALID_TO_IOCS16_RELEASED     EQU     30
     62
     63; PIO DIOR-/DIOW- to address valid hold (t9)
     64PIO_0_DIORW_TO_ADDR_VALID_HOLD              EQU     20
     65PIO_1_DIORW_TO_ADDR_VALID_HOLD              EQU     15
     66PIO_2_DIORW_TO_ADDR_VALID_HOLD              EQU     10
    6567
    6668
  • trunk/XTIDE_Universal_BIOS/Inc/BootVars.inc

    r592 r593  
    2929BOOT_READ_RETRY_TIMES       EQU     3
    3030
    31 ; Pre-boot variables. These do not exist after successful boot to OS.
    32 ; Segment is always 0000h, same as BDA segment
    33 struc BOOTVARS
    34                         resb    7C00h
    35     .rgbAtaInfo:                        ; 7C00h, ATA Information for drive detection
    36     .rgbBootSect        resb    512     ; 7C00h, Boot sector
    37                         resb    256     ; Boot Menu stack
    38     .rgbMnuStack:
    39     .dwPostStack        resb    4       ; POST stack pointer when entering INT 19h
    40 %ifdef MODULE_HOTKEYS
    41     .hotkeyVars         resb    HOTKEYVARS_size
    42 %endif
    43     .rgDrvDetectInfo:                   ; Array containing DRVDETECTINFO structs
    44 endstruc
    45 
    4631
    4732%ifdef MODULE_HOTKEYS
     
    6651
    6752%endif ; MODULE_HOTKEYS
     53
     54
     55; Pre-boot variables. These do not exist after successful boot to OS.
     56; Segment is always 0000h, same as BDA segment
     57struc BOOTVARS
     58                        resb    7C00h
     59    .rgbAtaInfo:                        ; 7C00h, ATA Information for drive detection
     60    .rgbBootSect        resb    512     ; 7C00h, Boot sector
     61                        resb    256     ; Boot Menu stack
     62    .rgbMnuStack:
     63    .dwPostStack        resb    4       ; POST stack pointer when entering INT 19h
     64%ifdef MODULE_HOTKEYS
     65    .hotkeyVars         resb    HOTKEYVARS_size ; Must be located just before DRVDETECTINFO structs
     66%endif
     67    .rgDrvDetectInfo:                   ; Array containing DRVDETECTINFO structs
     68endstruc
     69
    6870
    6971; MAX_HARD_DISK_NAME_LENGTH must be defined ahead of the DRVDETECTINFO structure to avoid problems with NASM
  • trunk/XTIDE_Universal_BIOS/Inc/HotkeyBar.inc

    r528 r593  
    2323MIN_TIME_TO_DISPLAY_HOTKEY_BAR          EQU (4000/55)   ; 4000 ms
    2424
     25FIRST_FUNCTION_KEY_SCANCODE             EQU 3Bh ; F1 key
     26
    2527ROM_BOOT_HOTKEY_SCANCODE                EQU 42h ; F8
    2628
  • trunk/XTIDE_Universal_BIOS/Inc/RamVars.inc

    r589 r593  
    2929%ifdef MODULE_SERIAL_FLOPPY OR MODULE_DRIVEXLATE
    3030    %define NEED_XLATEVARS
     31%endif
     32
     33
     34%ifdef NEED_XLATEVARS
     35; Variables for translating drive numbers.
     36    struc XLATEVARS
     37    %ifdef MODULE_SERIAL_FLOPPY
     38        .bFlopCreateCnt:
     39        .bFlopCntAndFirst   resb    1   ; Normally, packed starting floppy drive number (high order 7 bits)
     40                                        ; and number of drives (low order bit, max 2 drives supported).
     41                                        ; During initialization, until the end of DetectDrives_FromAllIDEControllers,
     42                                        ; this byte contains the raw number of floppy drives seen
     43                                        ; (using .bFlopCreateCnt)
     44    %else
     45                            resb    1   ; alignment
     46    %endif
     47
     48    %ifdef MODULE_DRIVEXLATE
     49        .bXlatedDrv         resb    1   ; Drive number after translation
     50        .wFDandHDswap:
     51        .bFDSwap            resb    1   ; Floppy Drive to swap to 00h and vice versa
     52        .bHDSwap            resb    1   ; Hard Drive to swap to 80h and vice versa
     53    %else
     54                            resb    1   ; alignment
     55    %endif
     56    endstruc
    3157%endif
    3258
     
    6692RAMVARS_DRV_DETECT_SIGNATURE    EQU 5A5Ah   ; Signature when BIOS is in drive detection mode
    6793
    68 
    69 %ifdef NEED_XLATEVARS
    70 ; Variables for translating drive numbers.
    71     struc XLATEVARS
    72     %ifdef MODULE_SERIAL_FLOPPY
    73         .bFlopCreateCnt:
    74         .bFlopCntAndFirst   resb    1   ; Normally, packed starting floppy drive number (high order 7 bits)
    75                                         ; and number of drives (low order bit, max 2 drives supported).
    76                                         ; During initialization, until the end of DetectDrives_FromAllIDEControllers,
    77                                         ; this byte contains the raw number of floppy drives seen
    78                                         ; (using .bFlopCreateCnt)
    79     %else
    80                             resb    1   ; alignment
    81     %endif
    82 
    83     %ifdef MODULE_DRIVEXLATE
    84         .bXlatedDrv         resb    1   ; Drive number after translation
    85         .wFDandHDswap:
    86         .bFDSwap            resb    1   ; Floppy Drive to swap to 00h and vice versa
    87         .bHDSwap            resb    1   ; Hard Drive to swap to 80h and vice versa
    88     %else
    89                             resb    1   ; alignment
    90     %endif
    91     endstruc
    92 %endif
    9394
    9495%ifdef MODULE_SERIAL_FLOPPY
  • trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc

    r592 r593  
    2222%define ROMVARS_INC
    2323
    24 ; ROM Variables. Written to the ROM image before flashing.
    25 struc ROMVARS
    26     .wRomSign           resb    2   ; ROM Signature (AA55h)
    27     .bRomSize           resb    1   ; ROM size in 512 byte blocks
    28     .rgbJump            resb    3   ; First instruction to ROM init (jmp)
    29 
    30     .rgbSign            resb    8   ; Signature for XTIDE Configurator Program
    31     .szTitle            resb    31  ; BIOS title string
    32     .szVersion          resb    25  ; BIOS version string
    33 
    34     .wFlags             resb    2   ; Word for ROM flags
    35     .wDisplayMode       resb    2   ; Display mode for boot menu
    36     .wBootTimeout       resb    2   ; Boot Menu selection timeout in system timer ticks
    37     .pColorTheme        resb    2   ; Ptr to the color attribute struc used by the boot menu and hotkey bar
    38     .bIdeCnt            resb    1   ; Number of available IDE controllers
    39     .bBootDrv           resb    1   ; Default drive to boot from
    40     .bMinFddCnt         resb    1   ; Minimum number of Floppy Drives
    41     .bStealSize         resb    1   ; Number of 1kB blocks stolen from 640kB base RAM
    42     .bIdleTimeout       resb    1   ; Standby timer value
    43 
    44     .ideVarsBegin:
    45     .ideVars0           resb    IDEVARS_size
    46     .ideVars1           resb    IDEVARS_size
    47     .ideVars2           resb    IDEVARS_size
    48     .ideVars3           resb    IDEVARS_size
    49 
    50 %ifdef MODULE_SERIAL
    51     .ideVarsSerialAuto  resb    IDEVARS_size
    52 %endif
    53 
    54     .ideVarsEnd:
     24
     25; Master/Slave drive specific parameters
     26struc DRVPARAMS
     27    .wFlags         resb    2   ; Drive flags
     28    .dwMaximumLBA:              ; User specified maximum number of sectors
     29    .wCylinders     resb    2   ; User specified cylinders (1...16383)
     30    .wHeadsAndSectors:
     31    .bHeads         resb    1   ; User specified Heads (1...16)
     32    .bSect          resb    1   ; User specified Sectors per track (1...63)
    5533endstruc
    5634
    57 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
    58     %if ROMVARS.ideVarsEnd & 0xff00 <> 0
    59         %error ".ideVars structures must fit within the first 256 bytes of the ROM image"
    60     %endif
    61     %if (ROMVARS.ideVarsEnd - ROMVARS.ideVarsBegin) = 0
    62         %error "there must be at least one .ideVars structure, it would be bizarre if this were not true, but it is assumed in the ah0h reset code."
    63     %endif
    64 %endif
    65 
    66 NUMBER_OF_IDEVARS                   EQU ((ROMVARS.ideVarsEnd - ROMVARS.ideVarsBegin) / IDEVARS_size)
    67 
    68 ; Bit defines for ROMVARS.wFlags
    69 FLG_ROMVARS_FULLMODE                EQU (1<<0)  ; Full operating mode (steals base RAM, supports EBIOS etc.)
    70 FLG_ROMVARS_SERIAL_SCANDETECT       EQU (1<<3)  ; Scan COM ports at the end of drive detection.  Can also be invoked
    71                                                 ; by holding down the ALT key at the end of drive detection.
    72                                                 ; (Conveniently, this is 8, a fact we exploit when testing the bit)
    73 
    74 ; Here in case the configuration needs to know functionality is present. Note! Changing the order/location of these flags
    75 ; also requires changes elsewhere as they are usually tested using byte-accesses for efficiency.
    76 FLG_ROMVARS_MODULE_POWER_MANAGEMENT     EQU (1<<5)
    77 FLG_ROMVARS_MODULE_8BIT_IDE             EQU (1<<6)
    78 FLG_ROMVARS_MODULE_8BIT_IDE_ADVANCED    EQU (1<<7)
    79 FLG_ROMVARS_MODULE_ADVANCED_ATA         EQU (1<<8)
    80 FLG_ROMVARS_MODULE_BOOT_MENU            EQU (1<<9)
    81 FLG_ROMVARS_MODULE_EBIOS                EQU (1<<10)
    82 FLG_ROMVARS_MODULE_HOTKEYS              EQU (1<<11)
    83 FLG_ROMVARS_MODULE_IRQ                  EQU (1<<12)
    84 FLG_ROMVARS_MODULE_SERIAL               EQU (1<<13)
    85 FLG_ROMVARS_MODULE_SERIAL_FLOPPY        EQU (1<<14)
    86 FLG_ROMVARS_MODULE_STRINGS_COMPRESSED   EQU (1<<15)
    87 
    88 
    89 ; Boot Menu Display Modes (see Assembly Library Display.inc for standard modes)
    90 DEFAULT_TEXT_MODE       EQU 4
     35; Bit defines for DRVPARAMS.wFlags - these flags are accessed as bytes so changes here might require changes elsewhere
     36MASK_DRVPARAMS_WRITECACHE       EQU (3<<0)  ; Bits 0...1, Drive internal write cache settings (must start at bit 0)
     37    DEFAULT_WRITE_CACHE             EQU 0   ; Must be 0
     38    DISABLE_WRITE_CACHE             EQU 1
     39    ENABLE_WRITE_CACHE              EQU 2
     40MASK_DRVPARAMS_TRANSLATEMODE    EQU (3<<TRANSLATEMODE_FIELD_POSITION)   ; Bits 2...3, Position shared with DPT
     41    TRANSLATEMODE_FIELD_POSITION    EQU 2
     42    TRANSLATEMODE_NORMAL            EQU 0   ; Must be zero
     43    TRANSLATEMODE_LARGE             EQU 1
     44    TRANSLATEMODE_ASSISTED_LBA      EQU 2   ; 28-bit or 48-bit LBA
     45    TRANSLATEMODE_AUTO              EQU 3   ; Only available in ROMVARS, not in DPTs
     46FLG_DRVPARAMS_BLOCKMODE         EQU (1<<4)  ; Enable Block mode transfers
     47FLG_DRVPARAMS_USERCHS           EQU (1<<5)  ; User specified P-CHS values
     48    MAX_PCHS_CYLINDERS              EQU 16383
     49    MAX_PCHS_HEADS                  EQU 16
     50    MAX_PCHS_SECTORS_PER_TRACK      EQU 63
     51    MAX_PCHS_TOTAL_SECTOR_COUNT     EQU (MAX_PCHS_CYLINDERS * MAX_PCHS_HEADS * MAX_PCHS_SECTORS_PER_TRACK)  ; 16,514,064
     52FLG_DRVPARAMS_USERLBA           EQU (1<<6)  ; User specified LBA value
    9153
    9254
     
    173135XTCF_DEVICE_OFFSET                      EQU FIRST_XTCF_DEVICE                       ; Used for XT-CF device <--> mode conversion
    174136
    175 ; Master/Slave drive specific parameters
    176 struc DRVPARAMS
    177     .wFlags         resb    2   ; Drive flags
    178     .dwMaximumLBA:              ; User specified maximum number of sectors
    179     .wCylinders     resb    2   ; User specified cylinders (1...16383)
    180     .wHeadsAndSectors:
    181     .bHeads         resb    1   ; User specified Heads (1...16)
    182     .bSect          resb    1   ; User specified Sectors per track (1...63)
     137
     138; ROM Variables. Written to the ROM image before flashing.
     139struc ROMVARS
     140    .wRomSign           resb    2   ; ROM Signature (AA55h)
     141    .bRomSize           resb    1   ; ROM size in 512 byte blocks
     142    .rgbJump            resb    3   ; First instruction to ROM init (jmp)
     143
     144    .rgbSign            resb    8   ; Signature for XTIDE Configurator Program
     145    .szTitle            resb    31  ; BIOS title string
     146    .szVersion          resb    25  ; BIOS version string
     147
     148    .wFlags             resb    2   ; Word for ROM flags
     149    .wDisplayMode       resb    2   ; Display mode for boot menu
     150    .wBootTimeout       resb    2   ; Boot Menu selection timeout in system timer ticks
     151    .pColorTheme        resb    2   ; Ptr to the color attribute struc used by the boot menu and hotkey bar
     152    .bIdeCnt            resb    1   ; Number of available IDE controllers
     153    .bBootDrv           resb    1   ; Default drive to boot from
     154    .bMinFddCnt         resb    1   ; Minimum number of Floppy Drives
     155    .bStealSize         resb    1   ; Number of 1kB blocks stolen from 640kB base RAM
     156    .bIdleTimeout       resb    1   ; Standby timer value
     157
     158    .ideVarsBegin:
     159    .ideVars0           resb    IDEVARS_size
     160    .ideVars1           resb    IDEVARS_size
     161    .ideVars2           resb    IDEVARS_size
     162    .ideVars3           resb    IDEVARS_size
     163
     164%ifdef MODULE_SERIAL
     165    .ideVarsSerialAuto  resb    IDEVARS_size
     166%endif
     167
     168    .ideVarsEnd:
    183169endstruc
    184170
    185 ; Bit defines for DRVPARAMS.wFlags - these flags are accessed as bytes so changes here might require changes elsewhere
    186 MASK_DRVPARAMS_WRITECACHE       EQU (3<<0)  ; Bits 0...1, Drive internal write cache settings (must start at bit 0)
    187     DEFAULT_WRITE_CACHE             EQU 0   ; Must be 0
    188     DISABLE_WRITE_CACHE             EQU 1
    189     ENABLE_WRITE_CACHE              EQU 2
    190 MASK_DRVPARAMS_TRANSLATEMODE    EQU (3<<TRANSLATEMODE_FIELD_POSITION)   ; Bits 2...3, Position shared with DPT
    191     TRANSLATEMODE_FIELD_POSITION    EQU 2
    192     TRANSLATEMODE_NORMAL            EQU 0   ; Must be zero
    193     TRANSLATEMODE_LARGE             EQU 1
    194     TRANSLATEMODE_ASSISTED_LBA      EQU 2   ; 28-bit or 48-bit LBA
    195     TRANSLATEMODE_AUTO              EQU 3   ; Only available in ROMVARS, not in DPTs
    196 FLG_DRVPARAMS_BLOCKMODE         EQU (1<<4)  ; Enable Block mode transfers
    197 FLG_DRVPARAMS_USERCHS           EQU (1<<5)  ; User specified P-CHS values
    198     MAX_PCHS_CYLINDERS              EQU 16383
    199     MAX_PCHS_HEADS                  EQU 16
    200     MAX_PCHS_SECTORS_PER_TRACK      EQU 63
    201     MAX_PCHS_TOTAL_SECTOR_COUNT     EQU (MAX_PCHS_CYLINDERS * MAX_PCHS_HEADS * MAX_PCHS_SECTORS_PER_TRACK)  ; 16,514,064
    202 FLG_DRVPARAMS_USERLBA           EQU (1<<6)  ; User specified LBA value
     171%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
     172    %if ROMVARS.ideVarsEnd & 0xff00 <> 0
     173        %error ".ideVars structures must fit within the first 256 bytes of the ROM image"
     174    %endif
     175    %if (ROMVARS.ideVarsEnd - ROMVARS.ideVarsBegin) = 0
     176        %error "there must be at least one .ideVars structure, it would be bizarre if this were not true, but it is assumed in the ah0h reset code."
     177    %endif
     178%endif
     179
     180NUMBER_OF_IDEVARS                   EQU ((ROMVARS.ideVarsEnd - ROMVARS.ideVarsBegin) / IDEVARS_size)
     181
     182; Bit defines for ROMVARS.wFlags
     183FLG_ROMVARS_FULLMODE                    EQU (1<<0)  ; Full operating mode (steals base RAM, supports EBIOS etc.)
     184FLG_ROMVARS_IGNORE_MOTHERBOARD_DRIVES   EQU (1<<1)  ; Ignores drives configured in motherboard BIOS setup.
     185                                                    ; For now it is a hack to get Windows 95 IDE drivers working
     186                                                    ; but it will be needed later when XTUB supports dynamic drive overlay.
     187                                                    ; Because of that this must be included into AT builds and cannot be a
     188                                                    ; module (any AT or 386 must be installable to the hard drive so
     189                                                    ; there won't be need for even more different builds).
     190FLG_ROMVARS_SERIAL_SCANDETECT           EQU (1<<3)  ; Scan COM ports at the end of drive detection.  Can also be invoked
     191                                                    ; by holding down the ALT key at the end of drive detection.
     192                                                    ; (Conveniently, this is 8, a fact we exploit when testing the bit)
     193
     194; Here in case the configuration needs to know functionality is present. Note! Changing the order/location of these flags
     195; also requires changes elsewhere as they are usually tested using byte-accesses for efficiency.
     196FLG_ROMVARS_MODULE_POWER_MANAGEMENT     EQU (1<<5)
     197FLG_ROMVARS_MODULE_8BIT_IDE             EQU (1<<6)
     198FLG_ROMVARS_MODULE_8BIT_IDE_ADVANCED    EQU (1<<7)
     199FLG_ROMVARS_MODULE_ADVANCED_ATA         EQU (1<<8)
     200FLG_ROMVARS_MODULE_BOOT_MENU            EQU (1<<9)
     201FLG_ROMVARS_MODULE_EBIOS                EQU (1<<10)
     202FLG_ROMVARS_MODULE_HOTKEYS              EQU (1<<11)
     203FLG_ROMVARS_MODULE_IRQ                  EQU (1<<12)
     204FLG_ROMVARS_MODULE_SERIAL               EQU (1<<13)
     205FLG_ROMVARS_MODULE_SERIAL_FLOPPY        EQU (1<<14)
     206FLG_ROMVARS_MODULE_STRINGS_COMPRESSED   EQU (1<<15)
     207
     208
     209; Boot Menu Display Modes (see Assembly Library Display.inc for standard modes)
     210DEFAULT_TEXT_MODE       EQU 4
     211
    203212
    204213%endif ; ROMVARS_INC
Note: See TracChangeset for help on using the changeset viewer.