Ignore:
Timestamp:
Jun 25, 2018, 10:29:27 PM (6 years ago)
Author:
krille_n_
Message:

Changes:

  • The problem with NASM in the previous revision (r591) has been fixed.
  • The colors used by the boot menu and hotkey bar can now be customized by selecting one of a number of pre-defined color themes. Suggestions for additional themes are more than welcome!
  • Large builds are now 10 KB. Small builds are still 8 KB with the exception of the Tiny build which is now 4 KB. In other words, builds are now as small as possible to make it easier to combine them with other BIOSes.
  • Added code to the library to improve drive error handling. XTIDECFG can now handle "Drive Not Ready" errors.
  • Fixed a couple of potential bugs in AtaID.asm (AtaID_GetMaxPioModeToAXandMinCycleTimeToCX); 1) ATA1.bPioMode was treated as a WORD variable. 2) ATA2.bPIOSupp was assumed to be non-zero which would result in PIO mode 3 being returned if the assumption was wrong.
  • Made the same changes in the equivalent function used by BIOSDRVS (DisplayPioModeInformationUsingAtaInfoFromDSBX in AtaInfo.asm).
  • Fixed a bug from r587 in PDC20x30.asm in PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX.
  • Fixed a bug from r523 in XTIDECFG where Auto Configure would only set the IRQ on one IDE interface on AT-builds.
  • XTIDECFG will now restore the default settings for the "Serial port virtual device" when reselecting it in the list of device types. This makes it behave consistently for all device types.
  • The eAAM macro is now used regardless if USE_UNDOC_INTEL is defined or not because it is apparently supported on all processors including the NEC V20/V30 CPUs.
  • Renamed the EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS define to EXCLUDE_FROM_XUB.
  • Added a define to exclude unused library code from BIOSDRVS (EXCLUDE_FROM_BIOSDRVS). This makes it a lot smaller than in previous revisions.
  • All unnecessary CLD-instructions are now under a new define 'CLD_NEEDED' which is only enabled for the BIOS. It is disabled for XTIDECFG and BIOSDRVS but can be enabled if needed by adding this define to the respective makefile. This change was made because these unnecessary instructions are wasteful and should never be needed. In fact, they only serve to hide bugs (in other peoples code) which I strongly believe should be avoided. I recommend people making their own BIOSes from source to not use this define as it's extremely unlikely to be needed.
  • Updated the copyright info in SerDrive and changed an URL to point to the new site.
  • Updated the copyright info and version number in BIOSDRVS.
  • Updated the copyright info in XTIDECFG.
  • Optimizations in general.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/IdeControllerMenu.asm

    r589 r592  
    135135    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgIdeCmdPort
    136136    at  MENUITEM.itemValue + ITEM_VALUE.wMinValue,                  dw  8h
    137     at  MENUITEM.itemValue + ITEM_VALUE.wMaxValue,                  dw  3f8h
     137    at  MENUITEM.itemValue + ITEM_VALUE.wMaxValue,                  dw  3F8h
    138138    at  MENUITEM.itemValue + ITEM_VALUE.fnValueReader,              dw  IdeControllerMenu_SerialReadPort
    139139    at  MENUITEM.itemValue + ITEM_VALUE.fnValueWriter,              dw  IdeControllerMenu_SerialWritePort
     
    306306    mov     [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
    307307
     308%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
     309%if IDEVARS.wBasePort = 0
     310    mov     [cs:g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], bx
     311%else
    308312    lea     ax, [bx+IDEVARS.wBasePort]
    309313    mov     [cs:g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
    310 
     314%endif
     315
     316%if IDEVARS.bSerialPort = 0
     317    mov     [cs:g_MenuitemIdeControllerSerialPort+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], bx
     318%else
    311319    lea     ax, [bx+IDEVARS.bSerialPort]
    312320    mov     [cs:g_MenuitemIdeControllerSerialPort+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
     321%endif
     322%endif
    313323
    314324    lea     ax, [bx+IDEVARS.bSerialBaud]
     
    361371ALIGN JUMP_ALIGN
    362372.EnableOrDisableCommandBlockPort:
    363     mov     bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
     373    mov     bx, [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
    364374    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
    365375    mov     bx, g_MenuitemIdeControllerCommandBlockAddress
     
    380390ALIGN JUMP_ALIGN
    381391.EnableOrDisableControlBlockPort:
    382     mov     bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
     392    mov     bx, [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
    383393    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
    384394    mov     bx, g_MenuitemIdeControllerControlBlockAddress
     
    404414    jz      SHORT .DisableMenuitemFromCSBX
    405415
    406     mov     bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
     416    mov     bx, [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
    407417    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
    408418    mov     bx, g_MenuitemIdeControllerEnableInterrupt
     
    424434ALIGN JUMP_ALIGN
    425435.EnableOrDisableIRQchannelSelection:
    426     mov     bx, [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
     436    mov     bx, [g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
    427437    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
    428438    mov     bx, g_MenuitemIdeControllerIdeIRQ
     
    453463
    454464
     465;--------------------------------------------------------------------
     466; .EnableOrDisableSerial
     467;   Parameters:
     468;       SS:BP:  Menu handle
     469;   Returns:
     470;       Nothing
     471;   Corrupts registers:
     472;       AX, BX
     473;--------------------------------------------------------------------
    455474.EnableOrDisableSerial:
    456475    mov     bx, g_MenuitemIdeControllerSerialBaud
     
    463482    call    DisableMenuitemFromCSBX
    464483
    465     mov     bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
     484    mov     bx, [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
    466485    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
    467486    cmp     al, DEVICE_SERIAL_PORT
    468     jne     .DisableAllSerial
     487    jne     SHORT .DisableAllSerial
    469488
    470489    mov     bx, g_MenuitemIdeControllerSerialCOM
     
    474493    call    EnableMenuitemFromCSBX
    475494
    476     mov     bx, [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
     495    mov     bx, [g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
    477496    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
    478497    mov     bx, g_MenuitemIdeControllerSerialPort
     
    483502    ret
    484503
     504
    485505;--------------------------------------------------------------------
    486506; MENUITEM activation functions (.fnActivate)
     
    531551    jmp     MasterSlaveMenu_EnterMenuOrModifyItemVisibility
    532552
    533 ;------------------------------------------------------------------------------------------
    534 ;
    535 ; Reader/Writer Routines
    536 ;
    537 ; For serial drives, we pack the port number and baud rate into a single byte, and thus
    538 ; we need to take care to properly read/write just the bits we need.  In addition, since
    539 ; we use the Port/PortCtrl bytes in a special way for serial drives, we need to properly
    540 ; default the values stored in both these words when switching in and out of the Serial
    541 ; device choice.
    542 ;
    543 ; Writers:
    544 ;   Parameters:
    545 ;       AX:     Value that the MENUITEM system was interacting with
    546 ;       ES:DI:  ROMVARS location where the value is to be stored
     553
     554;--------------------------------------------------------------------
     555; IdeControllerMenu_WriteDevice
     556;
     557; Sets default values to ports and other device dependent stuff
     558;
     559;   Parameters:
     560;       AX:     IDE controller/Device type menu choice index
     561;       ES:DI:  Ptr to IDEVARS.bDevice
    547562;       DS:SI:  MENUITEM pointer
    548563;   Returns:
    549 ;       AX:     Value to actually write to ROMVARS
    550 ;   Corrupts registers:
    551 ;       AX
    552 ;
    553 ; Readers:
    554 ;   Parameters:
    555 ;       AX:     Value read from the ROMVARS location
    556 ;       ES:DI:  ROMVARS location where the value was just read from
    557 ;       DS:SI:  MENUITEM pointer
    558 ;   Returns:
    559 ;       AX:     Value that the MENUITEM system will interact with and display
    560 ;   Corrupts registers:
    561 ;       AX
    562 ;
    563 ALIGN JUMP_ALIGN
    564 WriterForXTCFwindow:
    565     xor     al, al
    566     SKIP2B  f
    567 ReaderForXTCFwindow:
    568     xor     ah, ah
    569     xchg    al, ah
    570     ret
    571 
    572 
     564;       AX:     IDE controller/Device type menu choice index
     565;   Corrupts registers:
     566;       BX, DX
     567;--------------------------------------------------------------------
    573568ALIGN JUMP_ALIGN
    574569IdeControllerMenu_WriteDevice:
    575     push    bx
    576570    push    di
    577571    push    ax
     
    581575
    582576    ; Note! AL is the choice index, not device code
    583     shl     al, 1                               ; Selection to device code
    584 
    585     ; Restore ports and other stuff to default values
     577    eSHL_IM al, 1                               ; Selection to device code
    586578    jz      SHORT .StandardIdeDevice            ; DEVICE_16BIT_ATA
    587579
     
    603595    div     bl
    604596    mov     bx, .rgbLowByteOfStdIdeInterfacePorts
    605     xlat
     597    xlat                                        ; DS=CS so no segment override needed
    606598    mov     ah, 1                               ; DEVICE_ATA_*_PORT >> 8
    607599    mov     bh, 3                               ; DEVICE_ATA_*_PORTCTRL >> 8
     
    622614
    623615.SupportForDeviceNotAvailable:
    624     push    dx
    625616    mov     dx, g_szUnsupportedDevice
    626617    call    Dialogs_DisplayErrorFromCSDX
    627     pop     dx
    628618
    629619    ; Restore device type to the previous value
     
    631621    mov     al, bl                              ; Previous device type to AL
    632622    shr     al, 1                               ; Device code to choice index
    633     jmp     SHORT .DoneWithNoChangeOfDevice
     623    pop     di
     624    ret
    634625
    635626.NotSerialDevice:
     
    670661
    671662.ChangingToSerial:
    672     cmp     bl, DEVICE_SERIAL_PORT
    673     je      SHORT .Done                         ; if we were already serial, nothing to do
    674 
     663;
     664; For serial drives, we pack the port number and baud rate into a single byte, and thus
     665; we need to take care to properly read/write just the bits we need.  In addition, since
     666; we use the Port/PortCtrl bytes in a special way for serial drives, we need to properly
     667; default the values stored in both these words when switching in and out of the Serial
     668; device choice.
     669;
     670    mov     al, SERIAL_DEFAULT_COM
    675671    mov     BYTE [es:di+IDEVARS.bSerialBaud-IDEVARS.wBasePort], SERIAL_DEFAULT_BAUD
    676     mov     BYTE [es:di+IDEVARS.bIRQ-IDEVARS.wBasePort], 0  ; Clear .bIRQ to keep the boot menu from printing it
    677 
    678     mov     al, SERIAL_DEFAULT_COM
     672    mov     [es:di+IDEVARS.bIRQ-IDEVARS.wBasePort], ah  ; Clear .bIRQ to keep the boot menu from printing it
     673
    679674    sub     di, IDEVARS.wBasePort - IDEVARS.bSerialCOMPortChar
    680675    call    IdeControllerMenu_SerialWriteCOM
     
    683678.Done:
    684679    pop     ax
    685 .DoneWithNoChangeOfDevice:
    686     pop     di          ; IDEVARS.bDevice
    687     pop     bx
     680    pop     di
    688681    ret
    689682
    690 ;
    691 ; Doesn't modify COM character (unless it is not recognized, which would be an error case),
    692 ; But does update the port address based on COM port selection
    693 ;
     683
     684;--------------------------------------------------------------------
     685; IdeControllerMenu_SerialWriteCOM
     686;
     687; Updates the port address based on COM port selection
     688;
     689;   Parameters:
     690;       AL:     COM port
     691;       ES:DI:  Ptr to IDEVARS.bSerialCOMPortChar
     692;       DS:SI:  MENUITEM pointer
     693;   Returns:
     694;       Nothing
     695;   Corrupts registers:
     696;       BX
     697;--------------------------------------------------------------------
    694698ALIGN JUMP_ALIGN
    695699IdeControllerMenu_SerialWriteCOM:
    696700    push    ax
    697     push    bx
    698701    push    si
    699702
    700     mov     si, g_rgbChoiceToValueLookupForCOM
    701     mov     bx, PackedCOMPortAddresses
    702 
    703 .loop:
    704     mov     ah, [bx]
    705 
    706     cmp     ah, (SERIAL_DEFAULT_CUSTOM_PORT >> 2)
    707     je      .notFound
    708 
    709     cmp     al, [si]
    710     je      .found
    711 
     703    mov     bx, PackedCOMPortAddresses - 1
     704    mov     si, g_rgbChoiceToValueLookupForCOM - 2
     705
     706.Loop:
     707    inc     bx
    712708    inc     si
    713709    inc     si
    714     inc     bx
    715 
    716     jmp     .loop
    717 
    718 .notFound:
    719     mov     al, 'x'
    720 
    721 .found:
     710
     711    mov     ah, [bx]
     712    cmp     ah, SERIAL_DEFAULT_CUSTOM_PORT >> 2
     713    je      SHORT .NotFound
     714
     715    cmp     al, [si]
     716    jne     SHORT .Loop
     717
     718.NotFound:
    722719    mov     [es:di+IDEVARS.bSerialPort-IDEVARS.bSerialCOMPortChar], ah
    723720
    724721    pop     si
    725     pop     bx
    726722    pop     ax
    727 
    728723    ret
    729724
    730725
     726;--------------------------------------------------------------------
     727; IdeControllerMenu_SerialReadPort
    731728;
    732729; Packed Port (byte) -> Numeric Port (word)
    733730;
     731;   Parameters:
     732;       AX:     Value read from the ROMVARS location
     733;       ES:DI:  ROMVARS location where the value was just read from
     734;       DS:SI:  MENUITEM pointer
     735;   Returns:
     736;       AX:     Value that the MENUITEM system will interact with and display
     737;   Corrupts registers:
     738;       Nothing
     739;--------------------------------------------------------------------
    734740ALIGN JUMP_ALIGN
    735741IdeControllerMenu_SerialReadPort:
     
    738744    ret
    739745
     746
     747;--------------------------------------------------------------------
     748; IdeControllerMenu_SerialWritePort
    740749;
    741750; Numeric Port (word) -> Packed Port (byte)
    742 ; And convert from Custom to a defined COM port if we match one of the pre-defined COM port numbers
    743 ;
     751;
     752; And convert from Custom to a defined COM port if we
     753; match one of the pre-defined COM port numbers
     754;
     755;   Parameters:
     756;       AX:     Value that the MENUITEM system was interacting with
     757;       ES:DI:  ROMVARS location where the value is to be stored
     758;       DS:SI:  MENUITEM pointer
     759;   Returns:
     760;       AX:     Value to actually write to ROMVARS
     761;   Corrupts registers:
     762;       BX
     763;--------------------------------------------------------------------
    744764ALIGN JUMP_ALIGN
    745765IdeControllerMenu_SerialWritePort:
    746     push    bx
    747766    push    si
    748767
    749768    eSHR_IM ax, 2
    750     and     al, 0feh            ; force 8-byte boundary
    751 
    752     mov     si, g_rgbChoiceToValueLookupForCOM
    753     mov     bx, PackedCOMPortAddresses          ; loop, looking for port address in known COM address list
    754 
    755 .loop:
    756     mov     ah, [si]
    757     cmp     ah, 'x'
    758     je      .found
    759 
    760     cmp     al, [bx]
    761     je      .found
    762 
     769    and     al, 0FEh                            ; Force 8-byte boundary
     770
     771    mov     si, g_rgbChoiceToValueLookupForCOM - 2
     772    mov     bx, PackedCOMPortAddresses - 1      ; Loop, looking for port address in known COM address list
     773
     774.Loop:
    763775    inc     si
    764776    inc     si
    765777    inc     bx
    766778
    767     jmp     .loop
    768 
    769 .found:
     779    mov     ah, [si]
     780    cmp     ah, 'x'
     781    je      SHORT .Found
     782
     783    cmp     al, [bx]
     784    jne     SHORT .Loop
     785
     786.Found:
    770787    mov     [es:di+IDEVARS.bSerialCOMPortChar-IDEVARS.bSerialPort], ah
    771788
    772789    pop     si
    773     pop     bx
    774 
    775790    ret
    776791
Note: See TracChangeset for help on using the changeset viewer.