Changeset 592 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS_Configurator_v2


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.
Location:
trunk/XTIDE_Universal_BIOS_Configurator_v2
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Inc/Variables.inc

    r583 r592  
    3434struc CFGVARS
    3535    .pMenupage          resb    2           ; Offset to MENUPAGE to display
    36     .wFlags             resb    2           ; Program flags
     36    .wFlags             resb    2           ; Program flags - Only the low byte is used currently and code depend on this
    3737    .wImageSizeInWords  resb    2           ; Size in words for loaded ROM or FILE
    3838    .wEepromSegment     resb    2           ; Segment where EEPROM is located
     
    4444endstruc
    4545
    46 ; Bit defines for CFGVARS.wFlags
     46; Bit defines for CFGVARS.wFlags (changes here might require changes elsewhere)
    4747FLG_CFGVARS_FILELOADED  EQU     (1<<0)  ; BIOS is loaded from file
    4848FLG_CFGVARS_ROMLOADED   EQU     (1<<1)  ; BIOS is loaded from EEPROM
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/AutoConfigure.asm

    r526 r592  
    4343    call    ResetIdevarsToDefaultValues
    4444    call    DetectIdePortsAndDevices
    45     call    EnableInterruptsForPrimaryAndSecondaryControllers
     45    call    EnableInterruptsForAllStandardControllers
    4646    call    StoreAndDisplayNumberOfControllers
    4747
     
    5555;   Parameters:
    5656;       DS:DI:  Ptr to ROMVARS
     57;       ES:DI:  Ptr to ROMVARS
    5758;   Returns:
    5859;       Nothing
     
    123124
    124125;--------------------------------------------------------------------
    125 ; EnableInterruptsForPrimaryAndSecondaryControllers
     126; EnableInterruptsForAllStandardControllers
    126127;   Parameters:
    127128;       DS:DI:  Ptr to ROMVARS
     
    130131;       Nothing
    131132;   Corrupts registers:
    132 ;       AX, ES
    133 ;--------------------------------------------------------------------
    134 ALIGN JUMP_ALIGN
    135 EnableInterruptsForPrimaryAndSecondaryControllers:
     133;       AX
     134;--------------------------------------------------------------------
     135ALIGN JUMP_ALIGN
     136EnableInterruptsForAllStandardControllers:
    136137    jcxz    .NoControllersDetected
    137138    call    Buffers_IsXTbuildLoaded
     
    148149    inc     ax  ; 15
    149150    cmp     WORD [di+IDEVARS.wBasePort], DEVICE_ATA_SECONDARY_PORT
     151
     152%if 0
     153    je      SHORT .EnableIrqAL
     154
     155    ; Defaults on the GSI Inc. Model 2C EIDE controller
     156    mov     al, 11
     157    cmp     WORD [di+IDEVARS.wBasePort], DEVICE_ATA_TERTIARY_PORT
     158    je      SHORT .EnableIrqAL
     159
     160    dec     ax  ; 10
     161    cmp     WORD [di+IDEVARS.wBasePort], DEVICE_ATA_QUATERNARY_PORT
     162%endif
     163
    150164    jne     SHORT .DoNotEnableIRQ
    151165
     
    153167    mov     [di+IDEVARS.bIRQ], al
    154168.DoNotEnableIRQ:
     169    add     di, IDEVARS_size
    155170    loop    .CheckNextController
    156171    pop     cx
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/BiosFile.asm

    r589 r592  
    4444    call    FileIO_CloseUsingHandleFromBX
    4545    call    DisplayFileLoadedSuccessfully
    46     jmp     SHORT .Return
     46    pop     ds
     47    ret
    4748
    4849.DisplayErrorMessage:
    4950    call    FileIO_CloseUsingHandleFromBX
    5051    call    DisplayFailedToLoadFile
    51 ALIGN JUMP_ALIGN
    52 .Return:
    5352    pop     ds
    5453    ret
     
    117116    pop     es
    118117    mov     di, g_cfgVars+CFGVARS.szOpenedFile
     118%ifdef CLD_NEEDED
    119119    cld
     120%endif
    120121    call    String_CopyDSSItoESDIandGetLengthToCX
    121122    clc
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Buffers.asm

    r589 r592  
    4949ALIGN JUMP_ALIGN
    5050Buffers_IsXtideUniversalBiosLoaded:
    51     test    WORD [cs:g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_FILELOADED | FLG_CFGVARS_ROMLOADED
     51    test    BYTE [cs:g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_FILELOADED | FLG_CFGVARS_ROMLOADED
    5252    jnz     SHORT .FileOrBiosLoaded
    53     or      cl, 1       ; Clear ZF
     53    test    sp, sp      ; Clear ZF
    5454    ret
    5555
     
    7676    add     di, BYTE ROMVARS.rgbSign
    7777    mov     cx, XTIDE_SIGNATURE_LENGTH / 2
     78%ifdef CLD_NEEDED
    7879    cld
     80%endif
    7981    eSEG_STR repe, cs, cmpsw
    8082
     
    9193;               Cleared if some other (AT, 386) build is loaded
    9294;   Corrupts registers:
    93 ;       DI, ES
     95;       Nothing
    9496;--------------------------------------------------------------------
    9597ALIGN JUMP_ALIGN
    9698Buffers_IsXTbuildLoaded:
    9799%strlen BUILD_TYPE_OFFSET   TITLE_STRING_START
     100    push    es
     101    push    di
    98102    call    Buffers_GetFileBufferToESDI
    99103    cmp     WORD [es:di+ROMVARS.szTitle+BUILD_TYPE_OFFSET+1], 'XT'  ; +1 is for '('
     104    pop     di
     105    pop     es
    100106    ret
    101107%undef BUILD_TYPE_OFFSET
     
    105111; Buffers_NewBiosWithSizeInDXCXandSourceInAXhasBeenLoadedForConfiguration
    106112;   Parameters:
    107 ;       AX:     EEPROM source (FLG_CFGVARS_FILELOADED or FLG_CFGVARS_ROMLOADED)
     113;       AL:     EEPROM source (FLG_CFGVARS_FILELOADED or FLG_CFGVARS_ROMLOADED)
    108114;       DX:CX:  EEPROM size in bytes
    109115;   Returns:
    110116;       Nothing
    111117;   Corrupts registers:
    112 ;       AX, CX, DX
     118;       CX, DX
    113119;--------------------------------------------------------------------
    114120ALIGN JUMP_ALIGN
    115121Buffers_NewBiosWithSizeInDXCXandSourceInAXhasBeenLoadedForConfiguration:
    116     and     WORD [cs:g_cfgVars+CFGVARS.wFlags], ~(FLG_CFGVARS_FILELOADED | FLG_CFGVARS_ROMLOADED | FLG_CFGVARS_UNSAVED)
    117     or      WORD [cs:g_cfgVars+CFGVARS.wFlags], ax
     122    and     BYTE [cs:g_cfgVars+CFGVARS.wFlags], ~(FLG_CFGVARS_FILELOADED | FLG_CFGVARS_ROMLOADED | FLG_CFGVARS_UNSAVED)
     123    or      [cs:g_cfgVars+CFGVARS.wFlags], al
    118124    shr     dx, 1
    119125    rcr     cx, 1
     
    135141ALIGN JUMP_ALIGN
    136142Buffers_SetUnsavedChanges:
    137     or      WORD [cs:g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_UNSAVED
     143    or      BYTE [cs:g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_UNSAVED
    138144    ret
    139145
    140146ALIGN JUMP_ALIGN
    141147Buffers_ClearUnsavedChanges:
    142     and     WORD [cs:g_cfgVars+CFGVARS.wFlags], ~FLG_CFGVARS_UNSAVED
     148    and     BYTE [cs:g_cfgVars+CFGVARS.wFlags], ~FLG_CFGVARS_UNSAVED
    143149    ret
    144150
     
    155161ALIGN JUMP_ALIGN
    156162Buffers_SaveChangesIfFileLoaded:
    157     mov     ax, [cs:g_cfgVars+CFGVARS.wFlags]
    158     and     ax, BYTE (FLG_CFGVARS_FILELOADED | FLG_CFGVARS_UNSAVED)
    159     cmp     ax, BYTE (FLG_CFGVARS_FILELOADED | FLG_CFGVARS_UNSAVED)
    160     jne     SHORT .NothingToSave
    161     call    Dialogs_DisplaySaveChangesDialog
     163    mov     al, [cs:g_cfgVars+CFGVARS.wFlags]
     164    and     al, FLG_CFGVARS_FILELOADED | FLG_CFGVARS_UNSAVED
     165    jz      SHORT .NothingToSave
     166    jpo     SHORT .NothingToSave
     167    mov     bx, g_szDlgSaveChanges
     168    call    Dialogs_DisplayYesNoResponseDialogWithTitleStringInBX
    162169    jnz     SHORT .NothingToSave
    163170    jmp     BiosFile_SaveUnsavedChanges
     
    181188
    182189    eMOVZX  di, [cs:g_cfgVars+CFGVARS.bEepromType]
    183     mov     cx, [cs:di+g_rgwEepromTypeToSizeInWords]
     190;%if g_rgwEepromTypeToSizeInWords = 0   ; *FIXME* It really is but NASM won't accept this.
     191    mov     cx, [cs:di]
     192;%else
     193;   mov     cx, [cs:di+g_rgwEepromTypeToSizeInWords]
     194;%endif
    184195    sub     cx, [cs:g_cfgVars+CFGVARS.wImageSizeInWords]    ; CX = WORDs to append
    185196    jbe     SHORT .NoNeedToAppendZeroes
     
    187198    call    Buffers_GetFileBufferToESDI
    188199    mov     ax, [cs:g_cfgVars+CFGVARS.wImageSizeInWords]
    189     shl     ax, 1
     200    eSHL_IM ax, 1
    190201    add     di, ax          ; ES:DI now point first unused image byte
    191202    xor     ax, ax
     203%ifdef CLD_NEEDED
    192204    cld
     205%endif
    193206    rep stosw
    194207ALIGN JUMP_ALIGN
     
    214227    call    Buffers_GetFileBufferToESDI
    215228    call    EEPROM_GetXtideUniversalBiosSizeFromESDItoDXCX
     229%ifdef CLD_NEEDED
     230    cld
     231%endif
    216232
    217233; Compatibility fix for 3Com 3C503 cards where the ASIC returns 8080h as the last two bytes of the ROM.
     
    223239    jne     SHORT .BiosSizeIsNot8K
    224240    ; The BIOS size is 8K and therefore a potential candidate for a 3Com 3C503 card.
    225     dec     cx
    226     dec     cx
     241    mov     cl, (8192 - 3) & 0FFh
    227242    mov     ah, 3
    228243ALIGN JUMP_ALIGN
     
    230245.SumNextByte:
    231246    add     al, [es:di]
    232 .NextChecksumByte:
    233247    inc     di
    234248    loop    .SumNextByte
     249.NextChecksumByte:
    235250    neg     al
    236     mov     [es:di], al
    237     inc     cx
     251    stosb
    238252    dec     ah
    239253    jnz     SHORT .NextChecksumByte
     
    306320
    307321;--------------------------------------------------------------------
    308 ; Buffers_GetFileBufferToESDI
    309322; Buffers_GetFlashComparisonBufferToESDI
    310323; Buffers_GetFileDialogItemBufferToESDI
     324; Buffers_GetFileBufferToESDI
    311325;   Parameters:
    312326;       Nothing
     
    320334Buffers_GetFileDialogItemBufferToESDI:
    321335    call    Buffers_GetFileBufferToESDI
    322     push    di
    323336    mov     di, es
    324     add     di, 1000h       ; Third 64k page
    325     mov     es, di
    326     pop     di
    327     ret
    328 ALIGN JUMP_ALIGN
     337    SKIP2B  f
    329338Buffers_GetFileBufferToESDI:
    330339    mov     di, cs
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Dialogs.asm

    r526 r592  
    4141    mov     cx, DIALOG_INPUT_size
    4242    call    Memory_ReserveCXbytesFromStackToDSSI
    43     call    InitializeDialogInputFromDSSI
    4443    mov     [si+DIALOG_INPUT.fszTitle], di
    4544    jmp     SHORT DisplayMessageDialogWithMessageInCSDXandDialogInputInDSSI
     
    6564    mov     cx, DIALOG_INPUT_size
    6665    call    Memory_ReserveCXbytesFromStackToDSSI
    67     call    InitializeDialogInputFromDSSI
    6866    mov     WORD [si+DIALOG_INPUT.fszTitle], g_szNotificationDialog
    6967    jmp     SHORT DisplayMessageDialogWithMessageInCSDXandDialogInputInDSSI
     
    123121
    124122;--------------------------------------------------------------------
    125 ; Dialogs_DisplayQuitDialog
    126 ; Dialogs_DisplaySaveChangesDialog
     123; Dialogs_DisplayYesNoResponseDialogWithTitleStringInBX
    127124;   Parameters:
     125;       BX:     Offset to dialog title string
    128126;       SS:BP:  Menu handle
    129127;   Returns:
     
    134132;--------------------------------------------------------------------
    135133ALIGN JUMP_ALIGN
    136 Dialogs_DisplayQuitDialog:
     134Dialogs_DisplayYesNoResponseDialogWithTitleStringInBX:
    137135    push    ds
    138136
     
    140138    call    Memory_ReserveCXbytesFromStackToDSSI
    141139    call    InitializeDialogInputFromDSSI
    142     mov     WORD [si+DIALOG_INPUT.fszTitle], g_szDlgExitToDos
    143     jmp     Dialogs_DisplayQuitAndSaveChangesDialogsSharedEnding
    144 
    145 
    146 ALIGN JUMP_ALIGN
    147 Dialogs_DisplaySaveChangesDialog:
    148     push    ds
    149 
    150     mov     cx, DIALOG_INPUT_size
    151     call    Memory_ReserveCXbytesFromStackToDSSI
    152     call    InitializeDialogInputFromDSSI
    153     mov     WORD [si+DIALOG_INPUT.fszTitle], g_szDlgSaveChanges
    154 Dialogs_DisplayQuitAndSaveChangesDialogsSharedEnding:
     140    mov     [si+DIALOG_INPUT.fszTitle], bx
    155141    mov     WORD [si+DIALOG_INPUT.fszItems], g_szMultichoiceBooleanFlag
    156142    CALL_MENU_LIBRARY GetSelectionToAXwithInputInDSSI
    157143    add     sp, BYTE DIALOG_INPUT_size
    158     cmp     ax, BYTE 1      ; 1 = YES
     144    dec     ax              ; -1 = NO, 0 = YES
    159145
    160146    pop     ds
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/EEPROM.asm

    r589 r592  
    5050;       DX:CX:  BIOS size in bytes
    5151;   Corrupts registers:
    52 ;       AX, BX, SI, DI
     52;       BX, SI, DI
    5353;--------------------------------------------------------------------
    5454ALIGN JUMP_ALIGN
     
    6161    call    LoadBytesFromRomToRamBuffer
    6262
    63     call    EEPROM_GetXtideUniversalBiosSizeFromESDItoDXCX
    6463    pop     es
    6564    ret
     
    9089;       Nothing
    9190;   Returns:
    92 ;       CF:     Set if EEPROM was found
    93 ;               Cleared if EEPROM not found
    94 ;   Corrupts registers:
    95 ;       AX, BX, CX, SI, DI
     91;       CF:     Cleared if EEPROM was found
     92;               Set if EEPROM not found
     93;   Corrupts registers:
     94;       BX, CX, SI
    9695;--------------------------------------------------------------------
    9796ALIGN JUMP_ALIGN
     
    107106;       SI:     Offset to first byte to load
    108107;   Returns:
    109 ;       CF:     Set if EEPROM was found
    110 ;               Cleared if EEPROM not found
    111 ;   Corrupts registers:
    112 ;       AX, BX, CX, SI
     108;       CF:     Cleared if EEPROM was found
     109;               Set if EEPROM not found
     110;   Corrupts registers:
     111;       BX, SI
    113112;--------------------------------------------------------------------
    114113ALIGN JUMP_ALIGN
     
    119118
    120119    call    EEPROM_FindXtideUniversalBiosROMtoESDI
    121     jnc     SHORT .XtideUniversalBiosNotFound
     120    jc      SHORT .XtideUniversalBiosNotFound
    122121    push    es
    123122    pop     ds                                          ; DS:SI points to ROM
     
    126125    mov     di, si                                      ; ES:DI points to RAM buffer
    127126
     127%ifdef CLD_NEEDED
    128128    cld
    129     call    Memory_CopyCXbytesFromDSSItoESDI
    130     stc
     129%endif
     130    call    Memory_CopyCXbytesFromDSSItoESDI            ; Clears CF
    131131
    132132.XtideUniversalBiosNotFound:
     
    143143;   Returns:
    144144;       ES:DI:  EEPROM segment
    145 ;       CF:     Set if EEPROM was found
    146 ;               Cleared if EEPROM not found
    147 ;   Corrupts registers:
    148 ;       AX, BX
     145;       CF:     Cleared if EEPROM was found
     146;               Set if EEPROM not found
     147;   Corrupts registers:
     148;       BX
    149149;--------------------------------------------------------------------
    150150ALIGN JUMP_ALIGN
     
    159159    mov     es, bx                  ; Possible ROM segment to ES
    160160    call    Buffers_IsXtideUniversalBiosSignatureInESDI
    161     je      SHORT .RomFound
     161    je      SHORT .RomFound         ; If equal, CF=0
    162162    add     bx, 80h                 ; Increment by 2kB (minimum possible distance from the beginning of one option ROM to the next)
    163163    jnc     SHORT .SegmentLoop      ; Loop until segment overflows
    164     clc
    165     jmp     SHORT .ReturnWithoutUpdatingCF
    166 ALIGN JUMP_ALIGN
    167164.RomFound:
    168     stc
    169 .ReturnWithoutUpdatingCF:
    170165    pop     cx
    171166    pop     si
     
    191186    call    Buffers_GetFlashComparisonBufferToESDI
    192187    eMOVZX  bx, [cs:g_cfgVars+CFGVARS.bEepromType]
    193     mov     cx, [cs:bx+g_rgwEepromTypeToSizeInWords]
     188%ifdef CLD_NEEDED
    194189    cld
     190%endif
     191;%if g_rgwEepromTypeToSizeInWords = 0   ; *FIXME* It really is but NASM won't accept this.
     192    mov     cx, [cs:bx]
     193;%else
     194;   mov     cx, [cs:bx+g_rgwEepromTypeToSizeInWords]
     195;%endif
    195196    rep movsw
    196197
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Flash.asm

    r568 r592  
    7878ALIGN JUMP_ALIGN
    7979Flash_SinglePageWithFlashvarsInSSBP:
     80%ifdef CLD_NEEDED
    8081    cld
     82%endif
    8183    call    AreSourceAndDestinationPagesEqualFromFlashvarsInSSBP
    8284    je      SHORT .NoNeedToFlashThePage ; CF cleared
     
    305307ALIGN JUMP_ALIGN
    306308WaitUntilEepromPageWriteHasCompleted:
    307     call    .InitializeTimeoutCounterForEepromPollingWithFlashvarsInSSBP
    308     mov     es, [bp+FLASHVARS.fpNextDestinationPage+2]
    309     mov     di, [bp+FLASHVARS.wLastOffsetWritten]
    310 ALIGN JUMP_ALIGN
    311 .PollEeprom:
    312     call    .HasWriteCycleCompleted
    313     je      SHORT .PageWriteCompleted   ; CF cleared
    314     call    TimerTicks_GetTimeoutTicksLeftToAXfromDSBX
    315     jnc     SHORT .PollEeprom
    316 ALIGN JUMP_ALIGN
    317 .PageWriteCompleted:
    318     ret
    319 
    320 ;--------------------------------------------------------------------
    321 ; .InitializeTimeoutCounterForEepromPollingWithFlashvarsInSSBP
    322 ;   Parameters:
    323 ;       SS:BP:  Ptr to FLASHVARS
    324 ;   Returns:
    325 ;       DS:BX:  Ptr to timeout counter variable
    326 ;   Corrupts registers:
    327 ;       AX
    328 ;--------------------------------------------------------------------
    329 ALIGN JUMP_ALIGN
    330 .InitializeTimeoutCounterForEepromPollingWithFlashvarsInSSBP:
    331309    push    ss
    332310    pop     ds
    333311    lea     bx, [bp+FLASHVARS.wTimeoutCounter]
    334312    mov     ax, EEPROM_POLLING_TIMEOUT_TICKS
    335     jmp     TimerTicks_InitializeTimeoutFromAX
    336 
    337 ;--------------------------------------------------------------------
    338 ; .HasWriteCycleCompleted
    339 ;   Parameters:
    340 ;       ES:DI:  Ptr to last written byte in EEPROM
    341 ;       SS:BP:  Ptr to FLASHVARS
    342 ;   Returns:
    343 ;       ZF:     Set if write cycle has completed
    344 ;               Cleared if write cycle in progress
    345 ;   Corrupts registers:
    346 ;       AX
    347 ;--------------------------------------------------------------------
    348 ALIGN JUMP_ALIGN
    349 .HasWriteCycleCompleted:
    350     mov     ah, [es:di]     ; Load byte from EEPROM
    351     mov     al, [bp+FLASHVARS.bLastByteWritten]
    352     and     ax, 8080h       ; Clear all but bit 7 from both bytes
    353     cmp     al, ah          ; Set ZF if high bits are the same
    354     ret
    355 
     313    call    TimerTicks_InitializeTimeoutFromAX
     314    mov     es, [bp+FLASHVARS.fpNextDestinationPage+2]
     315    mov     di, [bp+FLASHVARS.wLastOffsetWritten]
     316ALIGN JUMP_ALIGN
     317.PollEeprom:
     318    mov     al, [es:di]                         ; Load byte from EEPROM
     319    xor     al, [bp+FLASHVARS.bLastByteWritten] ; Clear SF if the most significant bits are the same
     320    jns     SHORT .PageWriteCompleted           ; With CF cleared
     321    call    TimerTicks_GetTimeoutTicksLeftToAXfromDSBX
     322    jnc     SHORT .PollEeprom
     323ALIGN JUMP_ALIGN, ret
     324.PageWriteCompleted:
     325    ret
    356326
    357327;--------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/IdeAutodetect.asm

    r589 r592  
    118118    ; example Promise FloppyMAX has Control Block at STANDARD_CONTROL_BLOCK_OFFSET but Sound Blaster 16 (CT2290)
    119119    ; use DEVICE_ATA_SECONDARY_PORTCTRL for Tertiary and Quaternary even though only Secondary should use that.
    120     call    ChangeDifferentControlBlockAddressToSI
    121     je      SHORT .RedetectTertiaryOrQuaternaryWithDifferentControlBlockAddress
     120    call    ChangeControlBlockAddressInSI
     121    jz      SHORT .RedetectTertiaryOrQuaternaryWithDifferentControlBlockAddress
    122122
    123123
     
    130130    mov     si, dx
    131131    add     si, BYTE XTCF_CONTROL_BLOCK_OFFSET
    132     shl     bx, 1                       ; SHL 1 register offsets for XT-CF
     132    eSHL_IM bx, 1                       ; SHL 1 register offsets for XT-CF
    133133    call    DetectIdeDeviceFromPortsDXandSIwithOffsetsInBLandBH
    134134    mov     al, DEVICE_8BIT_XTCF_PIO8
     
    233233
    234234;--------------------------------------------------------------------
    235 ; ChangeDifferentControlBlockAddressToSI
     235; ChangeControlBlockAddressInSI
    236236;   Parameters:
    237237;       DX:     IDE Base Port address
     
    241241;               Cleared if different control block address is not possible
    242242;   Corrupts registers:
    243 ;       AH
    244 ;--------------------------------------------------------------------
    245 ChangeDifferentControlBlockAddressToSI:
     243;       Nothing
     244;--------------------------------------------------------------------
     245ChangeControlBlockAddressInSI:
    246246    cmp     si, 368h
    247247    je      SHORT .TrySecondAlternative
     
    252252    je      SHORT .TryLastAlternative
    253253    cmp     si, 3E0h
    254     je      SHORT .TryLastAlternative
    255     ret     ; Return with ZF cleared
     254    jne     SHORT .Return   ; With ZF cleared
    256255
    257256.TryLastAlternative:
     
    260259.TrySecondAlternative:
    261260    sub     si, BYTE 8h     ; 368h to 360h, 3E8h to 3E0h
    262     xor     ah, ah          ; Set ZF
     261    cmp     sp, sp          ; Set ZF
     262.Return:
    263263    ret
    264264
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Main.asm

    r589 r592  
    132132    call    Buffers_Clear
    133133    call    EEPROM_FindXtideUniversalBiosROMtoESDI
    134     jnc     SHORT .InitializationCompleted
     134    jc      SHORT .InitializationCompleted
    135135    mov     [CFGVARS.wEepromSegment], es
    136136.InitializationCompleted:
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/MenuEvents.asm

    r526 r592  
    8484    pop     ds
    8585
    86     mov     WORD [si+MENUINIT.wItems], ax
    87     mov     WORD [si+MENUINIT.bTitleLines], TITLE_LINES_IN_MENU
    88     mov     WORD [si+MENUINIT.bInfoLines], INFO_LINES_IN_MENU
     86    mov     [si+MENUINIT.wItems], ax
     87    mov     WORD [si+MENUINIT.wTitleAndInfoLines], INFO_LINES_IN_MENU << 8 | TITLE_LINES_IN_MENU
    8988    mov     BYTE [si+MENUINIT.bWidth], MENU_WIDTH
    9089    CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH
     
    112111ALIGN JUMP_ALIGN
    113112.QuitProgram:
    114     call    Dialogs_DisplayQuitDialog
     113    mov     bx, g_szDlgExitToDos
     114    call    Dialogs_DisplayYesNoResponseDialogWithTitleStringInBX
    115115    jz      SHORT .ExitToDOS
    116116    clc
     
    169169ALIGN JUMP_ALIGN
    170170.RefreshItemFromCX:
    171     cmp     cx, NO_ITEM_HIGHLIGHTED
    172     je      SHORT .NothingToRefresh
     171    inc     cx                  ; NO_ITEM_HIGHLIGHTED ?
     172    jz      SHORT .NothingToRefresh
     173    dec     cx
    173174    call    Menupage_GetActiveMenupageToDSDI
    174175    call    Menupage_GetCXthVisibleMenuitemToDSSIfromDSDI
     
    185186ALIGN JUMP_ALIGN
    186187.RefreshInformation:
    187     cmp     cx, NO_ITEM_HIGHLIGHTED
    188     je      SHORT .NothingToRefresh
     188    inc     cx                  ; NO_ITEM_HIGHLIGHTED ?
     189    jz      SHORT .NothingToRefresh
     190    dec     cx
    189191    call    Menupage_GetActiveMenupageToDSDI
    190192    call    Menupage_GetCXthVisibleMenuitemToDSSIfromDSDI
     
    213215ALIGN JUMP_ALIGN
    214216.PrintLoadStatus:
    215     mov     ax, [g_cfgVars+CFGVARS.wFlags]
    216     test    ax, FLG_CFGVARS_FILELOADED
     217    mov     al, [g_cfgVars+CFGVARS.wFlags]
     218    test    al, FLG_CFGVARS_FILELOADED
    217219    jnz     SHORT .PrintNameOfLoadedFile
    218     test    ax, FLG_CFGVARS_ROMLOADED
     220    test    al, FLG_CFGVARS_ROMLOADED
    219221    mov     si, g_szEEPROM
    220222    jnz     SHORT .PrintNameOfLoadedFileOrEeprom
     
    253255ALIGN JUMP_ALIGN
    254256.PrintStatusOfUnsavedChanges:
    255     test    WORD [g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_UNSAVED
     257    test    BYTE [g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_UNSAVED
    256258    jz      SHORT .ReturnSinceNothingToPrint
    257259    mov     si, g_szUnsaved
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menuitem.asm

    r567 r592  
    5353    call    Memory_ReserveCXbytesFromStackToDSSI
    5454    call    InitializeDialogInputInDSSIfromMenuitemInESDI
    55     mov     ax, [es:di+MENUITEM.itemValue + ITEM_VALUE.szMultichoice]
     55    mov     ax, [es:di+MENUITEM.itemValue+ITEM_VALUE.szMultichoice]
    5656    mov     [si+DIALOG_INPUT.fszItems], ax
    5757    push    di
     
    5959    pop     di
    6060
    61     cmp     ax, BYTE NO_ITEM_SELECTED
    62     je      SHORT .NothingToChange
     61    inc     ax              ; NO_ITEM_SELECTED ?
     62    jz      SHORT .NothingToChange
     63    dec     ax
    6364    call    Registers_CopyESDItoDSSI
    6465    call    Menuitem_StoreValueFromAXtoMenuitemInDSSI
     
    7071;--------------------------------------------------------------------
    7172; Menuitem_ActivateHexInputForMenuitemInDSSI
    72 ;   Parameters:
    73 ;       DS:SI:  Ptr to MENUITEM
    74 ;   Returns:
    75 ;       Nothing
     73; Menuitem_ActivateUnsignedInputForMenuitemInDSSI
     74;   Parameters:
     75;       DS:SI:  Ptr to MENUITEM
     76;   Returns:
     77;       CF:     Cleared if value inputted
     78;               Set if user cancellation
    7679;   Corrupts registers:
    7780;       AX, BX, CX, SI, DI, ES
    7881;--------------------------------------------------------------------
    79 ALIGN JUMP_ALIGN
    8082Menuitem_ActivateHexInputForMenuitemInDSSI:
     83    mov     bl, 16
     84    SKIP2B  ax
     85Menuitem_ActivateUnsignedInputForMenuitemInDSSI:
     86    mov     bl, 10
     87
    8188    call    Registers_CopyDSSItoESDI
    82 
    8389    mov     cx, WORD_DIALOG_IO_size
    8490    call    Memory_ReserveCXbytesFromStackToDSSI
    8591    call    InitializeDialogInputInDSSIfromMenuitemInESDI
    86     mov     BYTE [si+WORD_DIALOG_IO.bNumericBase], 16
    87     jmp     SHORT ContinueWordInput
    88 
    89 ;--------------------------------------------------------------------
    90 ; Menuitem_ActivateUnsignedInputForMenuitemInDSSI
    91 ;   Parameters:
    92 ;       DS:SI:  Ptr to MENUITEM
    93 ;   Returns:
    94 ;       CF:     Cleared if value inputted
    95 ;               Set if user cancellation
    96 ;   Corrupts registers:
    97 ;       AX, BX, CX, SI, DI, ES
    98 ;--------------------------------------------------------------------
    99 ALIGN JUMP_ALIGN
    100 Menuitem_ActivateUnsignedInputForMenuitemInDSSI:
    101     call    Registers_CopyDSSItoESDI
    102 
    103     mov     cx, WORD_DIALOG_IO_size
    104     call    Memory_ReserveCXbytesFromStackToDSSI
    105     call    InitializeDialogInputInDSSIfromMenuitemInESDI
    106     mov     BYTE [si+WORD_DIALOG_IO.bNumericBase], 10
    107 ContinueWordInput:
    108     mov     ax, [es:di+MENUITEM.itemValue + ITEM_VALUE.wMinValue]
     92    mov     [si+WORD_DIALOG_IO.bNumericBase], bl
     93    mov     ax, [es:di+MENUITEM.itemValue+ITEM_VALUE.wMinValue]
    10994    mov     [si+WORD_DIALOG_IO.wMin], ax
    110     mov     ax, [es:di+MENUITEM.itemValue + ITEM_VALUE.wMaxValue]
     95    mov     ax, [es:di+MENUITEM.itemValue+ITEM_VALUE.wMaxValue]
    11196    mov     [si+WORD_DIALOG_IO.wMax], ax
    11297    push    di
     
    138123ALIGN JUMP_ALIGN
    139124InitializeDialogInputInDSSIfromMenuitemInESDI:
    140     mov     ax, [es:di+MENUITEM.itemValue + ITEM_VALUE.szDialogTitle]
     125    mov     ax, [es:di+MENUITEM.itemValue+ITEM_VALUE.szDialogTitle]
    141126    mov     [si+DIALOG_INPUT.fszTitle], ax
    142127    mov     [si+DIALOG_INPUT.fszTitle+2], cs
     
    162147ALIGN JUMP_ALIGN
    163148Menuitem_StoreValueFromAXtoMenuitemInDSSI:
     149%if 0
     150    ; 3 bytes more but this will always invoke the Writer, even if it's an invalid item type (which might be useful).
    164151    eMOVZX  bx, [si+MENUITEM.bType]
    165152    cmp     bl, TYPE_MENUITEM_HEX
     153%else
     154    ; This will only invoke the Writer for valid item types.
     155    mov     bx, -TYPE_MENUITEM_MULTICHOICE & 0FFh
     156    add     bl, [si+MENUITEM.bType]
     157    jnc     SHORT .InvalidItemType
     158    cmp     bl, TYPE_MENUITEM_HEX - TYPE_MENUITEM_MULTICHOICE
     159%endif
    166160    ja      SHORT .InvalidItemType
    167161
     
    169163    add     di, [si+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
    170164
    171     push    bx
    172     mov     bx,[si+MENUITEM.itemValue+ITEM_VALUE.fnValueWriter]
    173     test    bx,bx
    174     jz      SHORT .NoWriter
    175     call    bx
    176 .NoWriter:
     165    push    WORD [cs:bx+.rgfnJumpToStoreValueBasedOnItemType]
     166    mov     bx, [si+MENUITEM.itemValue+ITEM_VALUE.fnValueWriter]
     167    test    bx, bx
     168    jnz     SHORT .InvokeWriter
     169.InvalidItemType:
    177170    pop     bx
    178 
    179     jmp     [cs:bx+.rgfnJumpToStoreValueBasedOnItemType]
    180 .InvalidItemType:
    181     ret
     171.InvokeWriter:
     172    jmp     bx              ; The Writer can freely corrupt BX
    182173
    183174ALIGN WORD_ALIGN
    184175.rgfnJumpToStoreValueBasedOnItemType:
    185     dw      .InvalidItemType                                    ; TYPE_MENUITEM_PAGEBACK
    186     dw      .InvalidItemType                                    ; TYPE_MENUITEM_PAGENEXT
    187     dw      .InvalidItemType                                    ; TYPE_MENUITEM_ACTION
     176;   dw      .InvalidItemType                                    ; TYPE_MENUITEM_PAGEBACK
     177;   dw      .InvalidItemType                                    ; TYPE_MENUITEM_PAGENEXT
     178;   dw      .InvalidItemType                                    ; TYPE_MENUITEM_ACTION
    188179    dw      .StoreMultichoiceValueFromAXtoESDIwithItemInDSSI    ; TYPE_MENUITEM_MULTICHOICE
    189180    dw      .StoreByteOrWordValueFromAXtoESDIwithItemInDSSI     ; TYPE_MENUITEM_UNSIGNED
     
    237228    jz      .StoreByteOrWordValueFromAXtoESDIwithItemInDSSI
    238229
    239     shl     ax, 1           ; Shift for WORD lookup
     230    eSHL_IM ax, 1           ; Shift for WORD lookup
    240231    add     bx, ax
    241232    mov     ax, [bx]        ; Lookup complete
     
    317308;       AX:     Menuitem value
    318309;   Corrupts registers:
    319 ;       BX
     310;       Nothing
    320311;--------------------------------------------------------------------
    321312ALIGN JUMP_ALIGN
     
    330321    test    BYTE [si+MENUITEM.bFlags], FLG_MENUITEM_BYTEVALUE
    331322    jz      SHORT .NoConvertWordToByteValue
    332     xor     ah, ah              ; conversion needs to happen before call to the reader,
    333                                 ; in case the reader unpacks the byte to a word
     323    xor     ah, ah          ; conversion needs to happen before call to the reader,
     324                            ; in case the reader unpacks the byte to a word
    334325
    335326.NoConvertWordToByteValue:
     
    338329    jz      SHORT .NoReader
    339330
    340     call    bx
     331    call    bx              ; The Reader can freely corrupt BX, DI and ES
    341332
    342333.NoReader:
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/MenuitemPrint.asm

    r590 r592  
    168168MenuitemPrint_WriteLookupValueStringToBufferInESDIfromUnshiftedItemInDSSI:
    169169    call    Menuitem_GetValueToAXfromMenuitemInDSSI
    170     shl     ax, 1
     170    eSHL_IM ax, 1
    171171    jmp     SHORT PrintLookupValueFromAXtoBufferInESDI
    172172
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/BootMenuSettingsMenu.asm

    r580 r592  
    11; Project name  :   XTIDE Universal BIOS Configurator v2
    2 ; Description   :   "Boot Menu Settings" menu structs and functions.
     2; Description   :   "Boot settings" menu structs and functions.
    33
    44;
     
    2626    at  MENUPAGE.fnEnter,           dw  BootMenuSettingsMenu_EnterMenuOrModifyItemVisibility
    2727    at  MENUPAGE.fnBack,            dw  ConfigurationMenu_EnterMenuOrModifyItemVisibility
    28     at  MENUPAGE.wMenuitems,        dw  6
     28    at  MENUPAGE.wMenuitems,        dw  7
    2929iend
    3030
     
    5555iend
    5656
     57g_MenuitemBootMnuStngsColorTheme:
     58istruc MENUITEM
     59    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
     60    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteLookupValueStringToBufferInESDIfromUnshiftedItemInDSSI
     61    at  MENUITEM.szName,            dw  g_szItemColorTheme
     62    at  MENUITEM.szQuickInfo,       dw  g_szNfoColorTheme
     63    at  MENUITEM.szHelp,            dw  g_szHelpColorTheme
     64    at  MENUITEM.bFlags,            db  FLG_MENUITEM_VISIBLE | FLG_MENUITEM_MODIFY_MENU
     65    at  MENUITEM.bType,             db  TYPE_MENUITEM_MULTICHOICE
     66    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  ROMVARS.pColorTheme     ; Only ever read - never modified
     67    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgColorTheme
     68    at  MENUITEM.itemValue + ITEM_VALUE.szMultichoice,              dw  g_szMultichoiceColorTheme
     69    at  MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup,     dw  NULL
     70    at  MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup,    dw  g_rgszValueToStringLookupForColorTheme
     71    at  MENUITEM.itemValue + ITEM_VALUE.fnValueReader,              dw  ReadColorTheme
     72    at  MENUITEM.itemValue + ITEM_VALUE.fnValueWriter,              dw  WriteColorTheme
     73iend
     74
    5775g_MenuitemBootMnuStngsFloppyDrives:
    5876istruc MENUITEM
     
    116134    at  MENUITEM.itemValue + ITEM_VALUE.wMaxValue,                  dw  1092
    117135iend
    118 
    119 
    120 g_rgwChoiceToValueLookupForEnableBootMenu:
    121     dw  FALSE
    122     dw  BOOT_MENU_DEFAULT_TIMEOUT
    123136
    124137g_rgwChoiceToValueLookupForDisplayModes:
     
    146159    dw  g_szValueBootFloppyDrvs4
    147160
     161g_rgszValueToStringLookupForColorTheme:
     162    dw  g_szValueColorTheme0
     163    dw  g_szValueColorTheme1
     164    dw  g_szValueColorTheme2
     165    dw  g_szValueColorTheme3
     166    dw  g_szValueColorTheme4
     167    dw  g_szValueColorTheme5
     168
     169ColorThemeTable:
     170    ; Classic (default)
     171    db  COLOR_ATTRIBUTE(COLOR_YELLOW, COLOR_BLUE)                           ; .cBordersAndBackground
     172    db  COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)                            ; .cShadow
     173    db  COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLUE)                     ; .cTitle
     174    db  COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLUE)                            ; .cItem
     175    db  COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_CYAN)                     ; .cHighlightedItem
     176    db  COLOR_ATTRIBUTE(COLOR_RED, COLOR_BLUE) | FLG_COLOR_BLINK            ; .cHurryTimeout
     177    db  COLOR_ATTRIBUTE(COLOR_GREEN, COLOR_BLUE)                            ; .cNormalTimeout
     178    ; Argon Blue
     179    db  COLOR_ATTRIBUTE(COLOR_LIGHT_BLUE, COLOR_BLACK)                      ; .cBordersAndBackground
     180    db  COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)                            ; .cShadow
     181    db  COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK)                    ; .cTitle
     182    db  COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK)                           ; .cItem
     183    db  COLOR_ATTRIBUTE(COLOR_LIGHT_BLUE, COLOR_BLACK)                      ; .cHighlightedItem
     184    db  COLOR_ATTRIBUTE(COLOR_LIGHT_BLUE, COLOR_BLACK) | FLG_COLOR_BLINK    ; .cHurryTimeout
     185    db  COLOR_ATTRIBUTE(COLOR_LIGHT_BLUE, COLOR_BLACK)                      ; .cNormalTimeout
     186    ; Neon Red
     187    db  COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK)                       ; .cBordersAndBackground
     188    db  COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)                            ; .cShadow
     189    db  COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK)                    ; .cTitle
     190    db  COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK)                           ; .cItem
     191    db  COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK)                       ; .cHighlightedItem
     192    db  COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) | FLG_COLOR_BLINK     ; .cHurryTimeout
     193    db  COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK)                       ; .cNormalTimeout
     194    ; Phosphor Green
     195    db  COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK)                     ; .cBordersAndBackground
     196    db  COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)                            ; .cShadow
     197    db  COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK)                    ; .cTitle
     198    db  COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK)                           ; .cItem
     199    db  COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK)                     ; .cHighlightedItem
     200    db  COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK) | FLG_COLOR_BLINK   ; .cHurryTimeout
     201    db  COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK)                     ; .cNormalTimeout
     202    ; Moon Surface
     203    db  COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)                            ; .cBordersAndBackground
     204    db  COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)                            ; .cShadow
     205    db  COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK)                    ; .cTitle
     206    db  COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK)                           ; .cItem
     207    db  COLOR_ATTRIBUTE(COLOR_BROWN, COLOR_BLACK)                           ; .cHighlightedItem
     208    db  COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) | FLG_COLOR_BLINK  ; .cHurryTimeout
     209    db  COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK)                           ; .cNormalTimeout
     210    ; Toxic Waste
     211    db  COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK)                     ; .cBordersAndBackground
     212    db  COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)                            ; .cShadow
     213    db  COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK)                     ; .cTitle
     214    db  COLOR_ATTRIBUTE(COLOR_LIGHT_CYAN, COLOR_BLACK)                      ; .cItem
     215    db  COLOR_ATTRIBUTE(COLOR_LIGHT_CYAN, COLOR_BLUE)                       ; .cHighlightedItem
     216    db  COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) | FLG_COLOR_BLINK     ; .cHurryTimeout
     217    db  COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK)                       ; .cNormalTimeout
     218EndOfColorThemeTable:
     219CountOfThemes   equ     (EndOfColorThemeTable-ColorThemeTable) / ATTRIBUTE_CHARS_size
     220
    148221
    149222; Section containing code
     
    166239    call    .EnableOrDisableScanForSerialDrives
    167240    call    .EnableOrDisableDefaultBootDrive
     241    call    .EnableOrDisableColorThemeSelection
    168242    call    .EnableOrDisableBootMenuSelectionTimeout
    169243    mov     si, g_MenupageForBootMenuSettingsMenu
     
    202276    mov     bx, g_MenuitemBootMnuStngsDefaultBootDrive
    203277    test    ax, FLG_ROMVARS_MODULE_HOTKEYS | FLG_ROMVARS_MODULE_BOOT_MENU
     278    jmp     SHORT .DisableMenuitemFromCSBXifZFset
     279
     280
     281;--------------------------------------------------------------------
     282; .EnableOrDisableColorThemeSelection
     283;   Parameters:
     284;       AX:     ROMVARS.wFlags
     285;       SS:BP:  Menu handle
     286;   Returns:
     287;       Nothing
     288;   Corrupts registers:
     289;       BX
     290;--------------------------------------------------------------------
     291ALIGN JUMP_ALIGN
     292.EnableOrDisableColorThemeSelection:
     293    mov     bx, g_MenuitemBootMnuStngsColorTheme
     294    test    ax, FLG_ROMVARS_MODULE_BOOT_MENU
    204295    jmp     SHORT .DisableMenuitemFromCSBXifZFset
    205296
     
    244335
    245336;--------------------------------------------------------------------
    246 ; MENUITEM value reader functions
    247 ;   Parameters:
    248 ;       AX:     Value from MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset
    249 ;       DS:SI:  Ptr to MENUITEM
    250 ;       ES:DI:  Ptr to value variable
    251 ;   Returns:
    252 ;       AX:     Value with possible modifications
    253 ;   Corrupts registers:
    254 ;       Nothing
    255 ;--------------------------------------------------------------------
    256 ALIGN JUMP_ALIGN
    257 ValueReaderForEnableBootMenu:
    258     test    ax, ax
    259     jz      SHORT .NoNeedToModify
    260     mov     ax, TRUE<<1
    261 .NoNeedToModify:
     337; ReadColorTheme
     338;   Parameters:
     339;       AX:     Value read from the ROMVARS location
     340;       ES:DI:  ROMVARS location where the value was just read from
     341;       DS:SI:  MENUITEM pointer
     342;   Returns:
     343;       AX:     Value that the MENUITEM system will interact with and display
     344;   Corrupts registers:
     345;       BX, DI, ES
     346;--------------------------------------------------------------------
     347ALIGN JUMP_ALIGN
     348ReadColorTheme:
     349    push    ds
     350
     351    push    es                          ; ES -> DS
     352    pop     ds
     353    push    cs                          ; CS -> ES
     354    pop     es
     355
     356    mov     di, EndOfColorThemeTable-1  ; ES:DI now points to the end of the last theme in the table of available themes in XTIDECFG
     357    xor     bx, bx
     358
     359    push    si
     360    push    cx
     361    mov     cx, CountOfThemes
     362    std
     363.NextTheme:
     364    push    cx
     365    mov     cl, ATTRIBUTE_CHARS_size
     366    mov     si, ax                      ; [ROMVARS.pColorTheme] to SI
     367    dec     si
     368    add     si, cx                      ; DS:SI now points to the end of the ColorTheme in the loaded BIOS
     369    sub     di, bx                      ; Update the pointer to the end of the next theme in the table
     370
     371    ; We verify that the theme in the loaded BIOS exists in our table. If it doesn't exist then that most likely means
     372    ; the loaded BIOS doesn't contain MODULE_BOOT_MENU and the theme actually isn't a theme - it's code. Either way,
     373    ; we don't trust it enough to copy it over as corrupt/invalid settings could render the UI in XTIDECFG unreadable.
     374    repe    cmpsb
     375    mov     bx, cx
     376    pop     cx
     377    loopne  .NextTheme
     378    cld
     379    mov     ax, cx
     380    jne     SHORT .SkipCopy
     381
     382    ; Copy the color theme fron the loaded BIOS overwriting XTIDECFG's own theme
     383    inc     si
     384    mov     di, ColorTheme              ; ES:DI now points to ColorTheme in XTIDECFG
     385
     386    mov     cl, ATTRIBUTE_CHARS_size
     387    call    Memory_CopyCXbytesFromDSSItoESDI
     388
     389.SkipCopy:
     390    pop     cx
     391    pop     si
     392    pop     ds
    262393    ret
     394
     395
     396;--------------------------------------------------------------------
     397; WriteColorTheme
     398;   Parameters:
     399;       AX:     Value that the MENUITEM system was interacting with
     400;       ES:DI:  ROMVARS location where the value is to be stored
     401;       DS:SI:  MENUITEM pointer
     402;   Returns:
     403;       AX:     Value to actually write to ROMVARS
     404;   Corrupts registers:
     405;       Nothing
     406;--------------------------------------------------------------------
     407ALIGN JUMP_ALIGN
     408WriteColorTheme:
     409    push    cx
     410    push    si
     411    push    di
     412
     413    mov     cx, ATTRIBUTE_CHARS_size
     414    mul     cl                          ; Multiply with the menu choice index
     415    mov     si, ColorThemeTable
     416    add     si, ax
     417    mov     ax, [es:di]                 ; Fetch the ptr to ColorTheme
     418    mov     di, ax
     419
     420    call    Memory_CopyCXbytesFromDSSItoESDI
     421
     422    pop     di
     423    pop     si
     424    pop     cx
     425    ret
     426
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/ConfigurationMenu.asm

    r589 r592  
    245245;       Nothing
    246246;   Corrupts registers:
    247 ;       BX, DI, ES
     247;       BX
    248248;--------------------------------------------------------------------
    249249ALIGN JUMP_ALIGN
     
    262262;       Nothing
    263263;   Corrupts registers:
    264 ;       AX, BX, CX
     264;       AX, BX
    265265;--------------------------------------------------------------------
    266266ALIGN JUMP_ALIGN
     
    268268    call    Buffers_GetRomvarsFlagsToAX
    269269    mov     bx, g_MenuitemConfigurationKiBtoStealFromRAM
    270     test    ax, FLG_ROMVARS_FULLMODE
     270    test    al, FLG_ROMVARS_FULLMODE
    271271    jz      SHORT .DisableMenuitemFromCSBX
    272272    jmp     SHORT .EnableMenuitemFromCSBX
     
    319319;       All, except segments
    320320;--------------------------------------------------------------------
     321%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
     322%if (ROMVARS.ideVars0 | ROMVARS.ideVars1 | ROMVARS.ideVars2 | ROMVARS.ideVars3) & 0FF00h = 0
     323PrimaryIdeController:
     324    mov     bl, ROMVARS.ideVars0 & 0FFh
     325    SKIP2B  f
     326SecondaryIdeController:
     327    mov     bl, ROMVARS.ideVars1 & 0FFh
     328    SKIP2B  f
     329TertiaryIdeController:
     330    mov     bl, ROMVARS.ideVars2 & 0FFh
     331    SKIP2B  f
     332QuaternaryIdeController:
     333    mov     bl, ROMVARS.ideVars3 & 0FFh
     334    xor     bh, bh
     335    ; Fall to DisplayIdeControllerMenu
     336%else
    321337ALIGN JUMP_ALIGN
    322338PrimaryIdeController:
     
    338354    mov     bx, ROMVARS.ideVars3
    339355    ; Fall to DisplayIdeControllerMenu
     356%endif
     357%endif
    340358
    341359ALIGN JUMP_ALIGN
     
    383401;       Nothing
    384402;   Corrupts registers:
    385 ;       All
     403;       AX, BX, CX, DX
    386404;----------------------------------------------------------------------
    387405ConfigurationMenu_CheckAndMoveSerialDrivesToBottom:
     
    428446; move serial to end of list, others up
    429447;
     448%ifdef CLD_NEEDED
    430449    cld
    431 
     450%endif
    432451    mov     ax, di                      ; save end pointer of list after scan
    433 
    434452    sub     sp, IDEVARS_size            ; copy serial to temporary space on stack
    435 
    436453    mov     di, sp
    437454
     
    439456    pop     es
    440457
     458%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
    441459%if IDEVARS_size & 1
    442460    mov     cl, IDEVARS_size
     
    446464    rep movsw
    447465%endif
     466%endif
    448467
    449468    lea     di, [si-IDEVARS_size]       ; move up all the idevars below the serial, by one slot
    450 
    451469    mov     cx, ax                      ; restore end pointer of list, subtract off end of serial idevars
    452470    sub     cx, si
     
    462480    ; di is already at last IDEVARS position
    463481
     482%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
    464483%if IDEVARS_size & 1
    465484    mov     cl, IDEVARS_size
     
    469488    rep movsw
    470489%endif
     490%endif
    471491
    472492    add     sp, IDEVARS_size
     
    476496
    477497    mov     dh, 1                       ; set flag that we have done a relocation
    478 
    479498    jmp     SHORT .outerLoop
    480499
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/FlashMenu.asm

    r589 r592  
    185185    pop     ds
    186186
    187     cmp     WORD [cs:g_cfgVars+CFGVARS.wEepromSegment], 0
    188     jne     .alreadySet
     187    cmp     WORD [g_cfgVars+CFGVARS.wEepromSegment], 0
     188    jne     SHORT .AlreadySet
    189189
    190190    push    es
    191191    push    di
    192192    call    EEPROM_FindXtideUniversalBiosROMtoESDI
    193     push    es
    194     pop     ax
     193    mov     ax, es
    195194    pop     di
    196195    pop     es
    197     jc      .storeEepromSegment
     196    jnc     SHORT .StoreEepromSegment
    198197    mov     ax, DEFAULT_EEPROM_SEGMENT
    199 .storeEepromSegment:
    200     mov     WORD [cs:g_cfgVars+CFGVARS.wEepromSegment], ax
    201 
    202 .alreadySet:
    203 
     198.StoreEepromSegment:
     199    mov     [g_cfgVars+CFGVARS.wEepromSegment], ax
     200
     201.AlreadySet:
    204202    mov     si, g_MenupageForFlashMenu
    205203    jmp     Menupage_ChangeToNewMenupageInDSSI
     
    256254ALIGN JUMP_ALIGN, ret
    257255.ImageFitsInSelectedEeprom:
     256.DoNotGenerateChecksumByte:
    258257    ret
    259258
     
    271270    call    EEPROM_LoadFromRomToRamComparisonBuffer
    272271    call    Buffers_AppendZeroesIfNeeded
    273     test    WORD [cs:g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_CHECKSUM
     272    test    BYTE [cs:g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_CHECKSUM
    274273    jz      SHORT .DoNotGenerateChecksumByte
    275274    jmp     Buffers_GenerateChecksum
    276 .DoNotGenerateChecksumByte:
    277     ret
    278275
    279276;--------------------------------------------------------------------
     
    349346.GetSelectedEepromSizeInWordsToAX:
    350347    eMOVZX  bx, [cs:g_cfgVars+CFGVARS.bEepromType]
    351     mov     ax, [cs:bx+g_rgwEepromTypeToSizeInWords]
     348;%if g_rgwEepromTypeToSizeInWords = 0   ; *FIXME* It really is but NASM won't accept this.
     349    mov     ax, [cs:bx]
     350;%else
     351;   mov     ax, [cs:bx+g_rgwEepromTypeToSizeInWords]
     352;%endif
    352353    ret
    353354
  • 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
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/MainMenu.asm

    r546 r592  
    155155.EnableOrDisableXtideRomItems:
    156156    call    EEPROM_FindXtideUniversalBiosROMtoESDI
    157     jnc     SHORT .DisableAllRomItems
     157    jc      SHORT .DisableAllRomItems
    158158    or      BYTE [g_MenuitemMainMenuLoadXtideUniversalBiosFromRom+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
    159159    call    Buffers_IsXtideUniversalBiosLoaded
     
    201201ALIGN JUMP_ALIGN
    202202.EnableOrDisableFlashEeprom:
    203     test    WORD [g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_FILELOADED | FLG_CFGVARS_ROMLOADED
     203    test    BYTE [g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_FILELOADED | FLG_CFGVARS_ROMLOADED
    204204    jz      SHORT .DisableFlashEeprom
    205205    or      BYTE [g_MenuitemMainMenuFlashEeprom+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
     
    222222ALIGN JUMP_ALIGN
    223223.EnableOrDisableSave:
    224     test    WORD [g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_FILELOADED
     224    test    BYTE [g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_FILELOADED
    225225    jz      SHORT .DisableSave
    226226    or      BYTE [g_MenuitemMainMenuSaveFile+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
     
    257257    add     si, BYTE FILE_DIALOG_IO.szFile
    258258    call    BiosFile_LoadFileFromDSSItoRamBuffer
     259    call    LoadColorTheme
     260    ; *FIXME* Will load themes even from unrecognized versions of the BIOS which isn't really a problem but still 'unexpected behaviour' and therefore a bug.
    259261    call    MainMenu_EnterMenuOrModifyItemVisibility
    260262.CancelFileLoading:
     
    272274    mov     dx, g_szDlgMainLoadROM
    273275    call    Dialogs_DisplayNotificationFromCSDX
     276    call    LoadColorTheme
    274277    jmp     MainMenu_EnterMenuOrModifyItemVisibility
    275278
     
    281284    call    Buffers_SetUnsavedChanges
    282285    mov     dx, g_szDlgMainLoadStngs
    283     jmp     Dialogs_DisplayNotificationFromCSDX
    284 
     286    call    Dialogs_DisplayNotificationFromCSDX
     287    call    EEPROM_FindXtideUniversalBiosROMtoESDI
     288    call    LoadColorTheme.FromROM
     289    jmp     MainMenu_EnterMenuOrModifyItemVisibility
     290
     291
     292;--------------------------------------------------------------------
     293; LoadColorTheme
     294;   Parameters:
     295;       ES:     ROMVARS segment (only when loading theme from ROM)
     296;   Returns:
     297;       Nothing
     298;   Corrupts registers:
     299;       AX, BX, DI, ES
     300;--------------------------------------------------------------------
     301ALIGN JUMP_ALIGN
     302LoadColorTheme:
     303    call    Buffers_GetFileBufferToESDI
     304.FromROM:
     305    mov     ax, [es:ROMVARS.pColorTheme]
     306    jmp     ReadColorTheme
     307
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/MasterSlaveMenu.asm

    r583 r592  
    196196    dw  DISABLE_WRITE_CACHE
    197197    dw  ENABLE_WRITE_CACHE
    198 
    199198g_rgszChoiceToStringLookupForWriteCache:
    200199    dw  g_szValueBootDispModeDefault
     
    207206    dw  TRANSLATEMODE_ASSISTED_LBA
    208207    dw  TRANSLATEMODE_AUTO
    209 
    210208g_rgszChoiceToStringLookupForXlateMode:
    211209    dw  g_szValueDrvXlateNormal
     
    229227ALIGN JUMP_ALIGN
    230228MasterSlaveMenu_InitializeToDrvparamsOffsetInBX:
     229    push    ds
     230
     231    push    cs
     232    pop     ds
     233
     234%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
     235%if DRVPARAMS.wFlags = 0
     236    mov     ax, bx
     237%else
    231238    lea     ax, [bx+DRVPARAMS.wFlags]
    232     mov     [cs:g_MenuitemMasterSlaveBlockModeTransfers+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
    233     mov     [cs:g_MenuitemMasterSlaveChsTranslateMode+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
    234     mov     [cs:g_MenuitemMasterSlaveWriteCache+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
    235     mov     [cs:g_MenuitemMasterSlaveUserCHS+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
    236     mov     [cs:g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
     239%endif
     240%endif
     241    mov     [g_MenuitemMasterSlaveBlockModeTransfers+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
     242    mov     [g_MenuitemMasterSlaveChsTranslateMode+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
     243    mov     [g_MenuitemMasterSlaveWriteCache+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
     244    mov     [g_MenuitemMasterSlaveUserCHS+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
     245    mov     [g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
    237246
    238247    lea     ax, [bx+DRVPARAMS.wCylinders]
    239     mov     [cs:g_MenuitemMasterSlaveCylinders+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
     248    mov     [g_MenuitemMasterSlaveCylinders+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
    240249
    241250    lea     ax, [bx+DRVPARAMS.bHeads]
    242     mov     [cs:g_MenuitemMasterSlaveHeads+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
     251    mov     [g_MenuitemMasterSlaveHeads+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
    243252
    244253    lea     ax, [bx+DRVPARAMS.bSect]
    245     mov     [cs:g_MenuitemMasterSlaveSectors+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
     254    mov     [g_MenuitemMasterSlaveSectors+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
    246255
    247256    lea     ax, [bx+DRVPARAMS.dwMaximumLBA]
    248     mov     [cs:g_MenuitemMasterSlaveUserLbaValue+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
     257    mov     [g_MenuitemMasterSlaveUserLbaValue+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
     258
     259    pop     ds
    249260    ret
    250261
     
    283294    mov     bx, [g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
    284295    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
    285     test    ax, FLG_DRVPARAMS_USERLBA
     296    test    al, FLG_DRVPARAMS_USERLBA
    286297    jnz     SHORT .DisableCHSandEnableLBA
    287     test    ax, FLG_DRVPARAMS_USERCHS
     298    test    al, FLG_DRVPARAMS_USERCHS
    288299    jnz     SHORT .EnableCHSandDisableLBA
    289300
     
    320331ALIGN JUMP_ALIGN
    321332.EnableOrDisableCHandS:
    322     mov     bx, [cs:g_MenuitemMasterSlaveUserCHS+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
     333    mov     bx, [g_MenuitemMasterSlaveUserCHS+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
    323334    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
    324     test    ax, FLG_DRVPARAMS_USERCHS
     335    test    al, FLG_DRVPARAMS_USERCHS
    325336    jz      SHORT .DisableCHandS
    326     test    ax, FLG_DRVPARAMS_USERLBA
     337    test    al, FLG_DRVPARAMS_USERLBA
    327338    jnz     SHORT .DisableCHandS
    328339
     
    355366ALIGN JUMP_ALIGN
    356367.EnableOrDisableUserLbaValue:
    357     mov     bx, [cs:g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
     368    mov     bx, [g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
    358369    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
    359370    mov     bx, g_MenuitemMasterSlaveUserLbaValue
    360     test    ax, FLG_DRVPARAMS_USERCHS
     371    test    al, FLG_DRVPARAMS_USERCHS
    361372    jnz     SHORT .DisableMenuitemFromCSBX
    362     test    ax, FLG_DRVPARAMS_USERLBA
     373    test    al, FLG_DRVPARAMS_USERLBA
    363374    jz      SHORT .DisableMenuitemFromCSBX
    364375    ; Fall to .EnableMenuitemFromCSBX
     
    443454ALIGN JUMP_ALIGN
    444455MasterSlaveMenu_WriteCHSFlag:
    445     test    word [es:di], FLG_DRVPARAMS_USERCHS
    446     jnz     .alreadySet
     456    test    BYTE [es:di], FLG_DRVPARAMS_USERCHS
     457    jnz     SHORT .AlreadySet
    447458
    448459    push    ax
     
    466477    pop     ax
    467478
    468 .alreadySet:
     479.AlreadySet:
    469480    ret
    470481
     
    475486ALIGN JUMP_ALIGN
    476487MasterSlaveMenu_WriteLBAFlag:
    477     test    word [es:di], FLG_DRVPARAMS_USERLBA
    478     jnz     .alreadySet
     488    test    BYTE [es:di], FLG_DRVPARAMS_USERLBA
     489    jnz     SHORT .AlreadySet
    479490
    480491    push    ax
     
    490501    pop     ax
    491502
    492 .alreadySet:
     503.AlreadySet:
    493504    ret
     505
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Strings.asm

    r590 r592  
    4242g_szYes:                            db  "Yes",NULL
    4343
    44 ; Exit messages
     44; General Yes/No response type dialog messages
    4545g_szDlgExitToDos:       db  "Exit to DOS?",NULL
    4646g_szDlgSaveChanges:     db  "Do you want to save changes to XTIDE Universal BIOS image file?",NULL
    47 
     47g_szDlgDriveNotReady:   db  "Drive not ready! Retry?",NULL
    4848
    4949; Generic dialog strings
     
    9292g_szNfoMainFlash:       db  "Flash loaded BIOS image to EEPROM.",NULL
    9393g_szNfoMainSave:        db  "Save BIOS changes back to original file from which it was loaded.",NULL
    94 g_szNfoMainLicense:     db  "XTIDE Universal BIOS and XTIDECFG Copyright (C) 2009-2010 by Tomi Tilli, 2011-2016 by XTIDE Universal BIOS Team."
     94g_szNfoMainLicense:     db  "XTIDE Universal BIOS and XTIDECFG Copyright (C) 2009-2010 by Tomi Tilli, 2011-2018 by XTIDE Universal BIOS Team."
    9595                        db  " Released under GNU GPL v2, with ABSOLUTELY NO WARRANTY. Press ENTER for more details...",NULL
    9696g_szNfoMainHomePage:    db  "Visit http://xtideuniversalbios.org (home page) and http://vcfed.org/forum (support)",NULL
    9797
    9898g_szHelpMainLicense:    db  "XTIDE Universal BIOS and XTIDECFG Configuration program are Copyright 2009-2010 by Tomi Tilli,"
    99                         db  " 2011-2016 by XTIDE Universal BIOS Team. Released under GNU GPL v2. This software comes with ABSOLUTELY NO WARRANTY."
     99                        db  " 2011-2018 by XTIDE Universal BIOS Team. Released under GNU GPL v2. This software comes with ABSOLUTELY NO WARRANTY."
    100100                        db  " This is free software, and you are welcome to redistribute it under certain conditions."
    101101                        db  " See the LICENSE.TXT file that was included with this distribution,"
     
    423423g_szItemBootDrive:      db  "Default boot drive",NULL
    424424g_szItemBootDispMode:   db  "Display Mode",NULL
     425g_szItemColorTheme:     db  "Color Theme",NULL
    425426g_szItemBootFloppyDrvs: db  "Number of Floppy Drives",NULL
    426427g_szItemSerialDetect:   db  "Scan for Serial Drives",NULL
     
    429430g_szDlgBootDrive:       db  "Enter default drive number (0xh for Floppy Drives, 8xh for Hard Disks).",NULL
    430431g_szDlgBootDispMode:    db  "Select display mode.",NULL
     432g_szDlgColorTheme:      db  "Select color theme.",NULL
    431433g_szDlgBootFloppyDrvs:  db  "Select number of Floppy Drives in system.",NULL
    432434g_szDlgSerialDetect:    db  "Scan for serial drives?",NULL
     
    435437g_szNfoBootDrive:       db  "Default boot drive.",NULL
    436438g_szNfoDispMode:        db  "Display mode to set when booting.",NULL
     439g_szNfoColorTheme:      db  "Color theme used by the boot menu and the hotkey bar.",NULL
    437440g_szNfoBootFloppyDrvs:  db  "Number of Floppy Drives in system.",NULL
    438441g_szNfoSerialDetect:    db  "Scans all standard COM ports for serial drives."
     
    442445                        db  " When timer goes to zero, currently selected drive will be booted automatically."
    443446                        db  " Timeout can be disabled by setting this to 0.",NULL
    444 
    445447g_szHelpBootDrive:      db  "Drive to be set selected by default when Boot Menu is displayed.",NULL
    446 
     448g_szHelpColorTheme:     db  "Pick a theme from a list of several pre-defined themes to customize the colors used by the boot menu and, if"
     449                        db  " available, the hotkey bar. Selecting a theme or loading a BIOS, or its settings, from file or from ROM will"
     450                        db  " make XTIDECFG apply the theme to itself for easy preview. The ability to preview themes requires that"
     451                        db  " XTIDECFG is running in a display mode that can display colors. In other words, you may configure the"
     452                        db  " BIOS on a machine with a monochrome graphics adapter and not be able to preview the theme but the BIOS will"
     453                        db  " still use the selected theme when installed in a machine with a color graphics adapter.",NULL
    447454g_szHelpBootFloppyDrvs: db  "Detecting the correct number of floppy drives might fail when using a floppy controller with its own BIOS."
    448455                        db  " A minimum number of floppy drives can be specified to force non-detected drives to appear on boot menu.",NULL
    449 
    450456g_szHelpSerialDetect:   db  "Set to Yes, at the end of normal drive detection, COM ports 1-7 (in reverse order) will be scanned for a connection"
    451457                        db  " to a serial drive server. This option provides flexibility with the COM port and baud rate to be used,"
     
    468474g_szValueBootDispModeCO80:      db  "CO80",NULL
    469475g_szValueBootDispModeMono:      db  "Mono",NULL
     476
     477g_szMultichoiceColorTheme:      db  "Classic (default)",LF
     478                                db  "Argon Blue",LF
     479                                db  "Neon Red",LF
     480                                db  "Phosphor Green",LF
     481                                db  "Moon Surface",LF
     482                                db  "Toxic Waste",NULL
     483g_szValueColorTheme0:           db  "Classic",NULL
     484g_szValueColorTheme1:           db  "Argon",NULL
     485g_szValueColorTheme2:           db  "Neon",NULL
     486g_szValueColorTheme3:           db  "Phosphor",NULL
     487g_szValueColorTheme4:           db  "Moon",NULL
     488g_szValueColorTheme5:           db  "Toxic",NULL
    470489
    471490g_szMultichoiceBootFloppyDrvs:  db  "Autodetect",LF
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/makefile

    r481 r592  
    100100ASFLAGS += $(IHEADERS)          # Set header file directory paths
    101101ASFLAGS += -Worphan-labels      # Warn about labels without colon
    102 ASFLAGS += -O9                  # Optimize operands to their shortest forms
     102ASFLAGS += -Ox                  # Optimize operands to their shortest forms
    103103
    104104
     
    135135xt_unused: xt
    136136    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_xt_unused.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
    137     @perl ..\tools\unused.pl $(TARGET)_xt.lst $(TARGET)_xt_unused.asm
     137    @perl ..\Tools\unused.pl $(TARGET)_xt.lst $(TARGET)_xt_unused.asm
    138138
Note: See TracChangeset for help on using the changeset viewer.