Changeset 592 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src


Ignore:
Timestamp:
Jun 25, 2018, 10:29:27 PM (6 years ago)
Author:
Krister Nordvall
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/Src
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm

    r589 r592  
    200200%ifdef MODULE_IRQ
    201201    test    BYTE [bp+IDEPACK.bDeviceControl], FLG_DEVCONTROL_nIEN
     202%ifdef USE_386
     203    jnz     IdeWait_IRQorStatusFlagInBLwithTimeoutInBH
     204%else
    202205    jz      SHORT .PollStatusFlagInsteadOfWaitIrq
    203206    jmp     IdeWait_IRQorStatusFlagInBLwithTimeoutInBH
    204207.PollStatusFlagInsteadOfWaitIrq:
    205208%endif
     209%endif ; MODULE_IRQ
    206210    jmp     IdeWait_PollStatusFlagInBLwithTimeoutInBH
    207211
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm

    r582 r592  
    121121    jnz     SHORT .ChangeTo32bitDevice
    122122
    123     and     BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_IORDY   ; No IORDY supported if need to limit
     123    and     [di+DPT.bFlagsHigh], ah     ; Mask off FLGH_DPT_IORDY if IORDY not supported
    124124    MIN_U   [di+DPT_ADVANCED_ATA.bPioMode], al
    125125    mov     [di+DPT_ADVANCED_ATA.wMinPioCycleTime], bx
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/JrIdeTransfer.asm

    r545 r592  
    147147    lds     di, [bp+MEMPIOVARS.fpDPT]           ; DPT now in DS:DI
    148148%ifdef USE_386
    149     movzx   cx, BYTE [bp+MEMPIOVARS.bSectorsDone]
     149    movzx   cx, [bp+MEMPIOVARS.bSectorsDone]
    150150%else
    151151    mov     ch, 0                               ; Preserve CF
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm

    r589 r592  
    9797    sti                                 ; Enable interrupts
    9898%endif
     99%ifdef CLD_NEEDED
    99100    cld                                 ; String instructions to increment pointers
     101%endif
    100102    ePUSHA
    101103    push    ds
     
    193195
    194196    ; Push old INT 13h handler and restore registers
     197%ifdef USE_386
     198    push    DWORD [RAMVARS.fpOldI13h]
     199%else
    195200    push    WORD [RAMVARS.fpOldI13h+2]
    196201    push    WORD [RAMVARS.fpOldI13h]
     202%endif
    197203    mov     bx, [bp+IDEPACK.intpack+INTPACK.bx]
    198204    mov     di, [bp+IDEPACK.intpack+INTPACK.di]
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm

    r567 r592  
    126126    mov     cx, NUMBER_OF_IDEVARS
    127127
    128 .loop:
     128.Loop:
    129129    call    FindDPT_MasterOrSingleForIdevarsOffsetInDL
    130130    jc      SHORT .ControllerNotAvailable
     
    162162.ControllerNotAvailable:
    163163    add     dl, IDEVARS_size                            ; move Idevars pointer forward
    164     loop    .loop
     164    loop    .Loop
    165165    ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1Eh_XTCF.asm

    r589 r592  
    121121    ;
    122122    ; Also note that some machines, noteably the Olivetti M24 (also known as
    123     ; the AT&T PC6300 and Xerox 6060), have hardware errors in the BIU logic,
    124     ; resulting in reversed byte ordering.  Therefore, XTCF_8BIT_PIO_MODE is
    125     ; the default transfer mode for best system compatibility.
     123    ; the AT&T PC6300 or Xerox 6060 or Logabax Persona 1600), have hardware errors
     124    ; in the BIU logic, resulting in reversed byte ordering.  Therefore,
     125    ; XTCF_8BIT_PIO_MODE is the default transfer mode for best system compatibility.
    126126
    127127
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH41h_CheckIfExtensionsPresent.asm

    r567 r592  
    4646
    4747    mov     BYTE [bp+IDEPACK.intpack+INTPACK.ah], EBIOS_VERSION
    48     mov     WORD [bp+IDEPACK.intpack+INTPACK.bx], 0AA55h
     48    not     WORD [bp+IDEPACK.intpack+INTPACK.bx]    ; 55AAh = AA55h
    4949
    5050%ifdef MODULE_COMPATIBLE_TABLES
     
    7575;--------------------------------------------------------------------
    7676AH41h_GetSupportBitsToCX:
     77%ifdef USE_AT   ; Always in Full mode
     78%ifndef MODULE_8BIT_IDE OR MODULE_SERIAL
     79    mov     cx, ENHANCED_DRIVE_ACCESS_SUPPORT | ENHANCED_DISK_DRIVE_SUPPORT
     80%else
     81    mov     cx, ENHANCED_DRIVE_ACCESS_SUPPORT
     82    cmp     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_ATA
     83    jae     SHORT .DoNotSetEDDflag
     84    or      cl, ENHANCED_DISK_DRIVE_SUPPORT
     85%endif
     86%else ; ~USE_AT
    7787    mov     cx, ENHANCED_DRIVE_ACCESS_SUPPORT
    7888
    7989    ; DPTE needs buffer from RAM so do not return it in lite mode
    80 %ifndef USE_AT
    8190    test    BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
    8291    jz      SHORT .DoNotSetEDDflag
    83 %endif
    8492
    8593%ifdef MODULE_8BIT_IDE OR MODULE_SERIAL
     
    9199
    92100    or      cl, ENHANCED_DISK_DRIVE_SUPPORT ; AH=48h returns DPTE
     101%endif ; USE_AT
    93102.DoNotSetEDDflag:
    94103    ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Address.asm

    r589 r592  
    110110    and     al, MASKL_DPT_TRANSLATEMODE
    111111
    112 ;;; 0: ADDRESSING_MODE_NORMAL
     112;;; 0: TRANSLATEMODE_NORMAL
    113113    jz      SHORT DoNotConvertLCHS
    114114
    115 ;;; 1: ADDRESSING_MODE_LARGE
     115;;; 1: TRANSLATEMODE_LARGE
    116116    test    al, FLGL_DPT_ASSISTED_LBA
    117117    jz      SHORT ConvertLargeModeLCHStoPCHS
    118118
    119 ;;; 2: ADDRESSING_MODE_ASSISTED_LBA
     119;;; 2: TRANSLATEMODE_ASSISTED_LBA
    120120    ; Fall to ConvertAssistedLBAModeLCHStoLBARegisterValues
    121121
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm

    r567 r592  
    3030Int19h_BootLoaderHandler:
    3131    sti                                         ; Enable interrupts
     32%ifdef CLD_NEEDED
    3233    cld                                         ; String instructions to increment pointers
     34%endif
    3335%ifdef MODULE_VERY_LATE_INIT
    3436    LOAD_BDA_SEGMENT_TO ds, ax                  ; Load BDA segment (zero) to DS
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/AdvAtaInit.asm

    r589 r592  
    6060;       AX:     ID WORD specific for detected controller
    6161;   Returns:
    62 ;       AL:     Max supported PIO mode
    63 ;       AH:     FLGH_DPT_IORDY if IORDY supported, zero otherwise
     62;       AL:     Max supported PIO mode (only if ZF set)
     63;       AH:     ~FLGH_DPT_IORDY if IORDY not supported, -1 otherwise (only if ZF set)
    6464;       BX:     Min PIO cycle time (only if ZF set)
    6565;       ZF:     Set if PIO limit necessary
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/PDC20x30.asm

    r589 r592  
    127127
    128128    ; PDC20230C and PDC20630 clears the bit we set at the beginning
    129     in      al, dx
     129    in      al, dx  ; 1F2h
    130130    dec     dx
    131131    dec     dx      ; Base port
     
    139139;       AX:     ID WORD specific for detected controller
    140140;   Returns:
    141 ;       AL:     Max supported PIO mode
    142 ;       AH:     FLGH_DPT_IORDY if IORDY supported, zero otherwise
     141;       AL:     Max supported PIO mode (only if ZF set)
     142;       AH:     ~FLGH_DPT_IORDY if IORDY not supported, -1 otherwise (only if ZF set)
    143143;       BX:     Min PIO cycle time (only if ZF set)
    144144;       ZF:     Set if PIO limit necessary
     
    148148;--------------------------------------------------------------------
    149149PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX:
    150     cmp     ah, ID_PDC20630
    151     je      SHORT .Return       ; No need to limit anything
    152     mov     ax, 2               ; Limit PIO to 2 for ID_PDC20230
     150    cmp     ah, ID_PDC20230
     151    jne     SHORT .Return                           ; No need to limit anything for ID_PDC20630
     152    mov     ax, (~FLGH_DPT_IORDY & 0FFh) << 8 | 2   ; Limit PIO to 2 for ID_PDC20230
    153153    mov     bx, PIO_2_MIN_CYCLE_TIME_NS
    154     stc
    155154.Return:
    156155    ret
     
    206205;--------------------------------------------------------------------
    207206SetSpeedForDriveInCX:
    208     eMOVZX  bx, BYTE [di+DPT_ADVANCED_ATA.bPioMode]
    209     MIN_U   bl, 2   ; Limit to PIO2
    210     mov     bl, [cs:bx+.rgbPioModeToPDCspeedValue]
     207    mov     bx, .rgbPioModeToPDCspeedValue
     208    mov     al, [di+DPT_ADVANCED_ATA.bPioMode]
     209    MIN_U   al, 2   ; Limit to PIO2
     210    cs xlat
     211    xchg    bx, ax
    211212
    212213    add     dx, BYTE SECTOR_NUMBER_REGISTER
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/Vision.asm

    r589 r592  
    131131;       AH:     QDI Vision Controller ID
    132132;   Returns:
    133 ;       AL:     Max supported PIO mode
    134 ;       AH:     FLGH_DPT_IORDY if IORDY supported, zero otherwise
     133;       AL:     Max supported PIO mode (only if ZF set)
     134;       AH:     ~FLGH_DPT_IORDY if IORDY not supported, -1 otherwise (only if ZF set)
    135135;       BX:     Min PIO Cycle Time (only if ZF set)
    136136;       ZF:     Set if PIO limit necessary
     
    142142    cmp     ah, ID_QD6500
    143143    jne     SHORT .NoNeedToLimitForQD6580
    144 
    145     mov     ax, 2   ; Limit to PIO 2 because QD6500 does not support IORDY
     144    mov     ax, (~FLGH_DPT_IORDY & 0FFh) << 8 | 2   ; Limit to PIO 2 because QD6500 does not support IORDY
    146145    mov     bx, PIO_2_MIN_CYCLE_TIME_NS
    147146.NoNeedToLimitForQD6580:
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm

    r580 r592  
    104104;       DX:     User defined P-CHS to L-CHS translate mode
    105105;   Corrupts registers:
    106 ;       AX, BX, CX
     106;       AX, BX
    107107;--------------------------------------------------------------------
    108108AtaID_ModifyESSIforUserDefinedLimitsAndReturnTranslateModeInDX:
     
    113113    pop     ds
    114114
    115     ; Load User Defined CHS or LBA to CX:AX
    116     mov     dx, [bx+DRVPARAMS.wFlags]
     115    ; Load User Defined CHS or LBA to BX:AX
     116    mov     dl, [bx+DRVPARAMS.wFlags]           ; Only load the flags we actually need
    117117    mov     ax, [bx+DRVPARAMS.wCylinders]       ; Or .dwMaximumLBA
    118     mov     cx, [bx+DRVPARAMS.wHeadsAndSectors] ; Or .dwMaximumLBA+2
     118    mov     bx, [bx+DRVPARAMS.wHeadsAndSectors] ; Or .dwMaximumLBA+2
    119119
    120120    push    es
     
    127127    ; Apply new CHS and disable LBA (we also want to set CHS addressing)
    128128    mov     [si+ATA1.wCylCnt], ax
    129     eMOVZX  ax, cl
     129    eMOVZX  ax, bl
    130130    mov     [si+ATA1.wHeadCnt], ax
    131     mov     al, ch
     131    mov     al, bh
    132132    mov     [si+ATA1.wSPT], ax
    133133    and     BYTE [si+ATA1.wCaps+1], ~(A1_wCaps_LBA>>8)
     
    140140
    141141    ; Apply new LBA and disable LBA48
    142     cmp     cx, [si+ATA1.dwLBACnt+2]
     142    cmp     bx, [si+ATA1.dwLBACnt+2]
    143143    ja      SHORT .NoUserDefinedLBA     ; Do not set larger than drive
    144144    jb      SHORT .StoreNewLBA
     
    147147.StoreNewLBA:
    148148    mov     [si+ATA1.dwLBACnt], ax
    149     mov     [si+ATA1.dwLBACnt+2], cx
     149    mov     [si+ATA1.dwLBACnt+2], bx
    150150    and     BYTE [si+ATA6.wSetSup83+1], ~(A6_wSetSup83_LBA48>>8)
    151151.NoUserDefinedLBA:
     
    173173AtaID_GetMaxPioModeToAXandMinCycleTimeToCX:
    174174    ; Get PIO mode and cycle time for PIO 0...2
    175     mov     bx, [es:si+ATA1.bPioMode]
    176     mov     ax, bx                  ; AH = 0, AL = PIO mode 0, 1 or 2
    177     eSHL_IM bx, 1                   ; Shift for WORD lookup
     175%ifdef USE_386
     176    movzx   ax, [es:si+ATA1.bPioMode]   ; AH = 0, AL = PIO mode 0, 1 or 2
     177%else
     178    mov     al, [es:si+ATA1.bPioMode]
     179    cbw
     180%endif
     181    mov     bx, ax
     182    eSHL_IM bx, 1                       ; Shift for WORD lookup
    178183    mov     cx, [cs:bx+.rgwPio0to2CycleTimeInNanosecs]
    179184
    180185    ; Check if IORDY is supported
    181186    test    BYTE [es:si+ATA2.wCaps+1], A2_wCaps_IORDY >> 8
    182     jz      SHORT .ReturnPioTimings ; No PIO 3 or higher if no IORDY
    183     mov     ah, FLGH_DPT_IORDY
     187    jz      SHORT .ReturnPioTimings     ; No PIO 3 or higher if no IORDY
     188    mov     ah, FLGH_DPT_IORDY          ; *FIXME* Actually, CF specification v4.1 says that use of IORDY is invalid for PIO modes 5 and 6.
    184189
    185190    ; Check if Advanced PIO modes are supported (3 and above)
     
    187192    jz      SHORT .ReturnPioTimings
    188193
    189     ; Get Advanced PIO mode
    190     ; (Hard Disks supports up to 4 but CF cards can support 5 and 6)
    191     mov     bl, [es:si+ATA2.bPIOSupp]
     194    ; Get Advanced PIO mode (Hard Disks supports up to 4 but CF cards can support 5 and 6)
     195    or      bh, [es:si+ATA2.bPIOSupp]
     196    jz      SHORT .ReturnPioTimings
    192197.CheckNextFlag:
    193198    inc     ax
    194     shr     bl, 1
     199    shr     bh, 1
    195200    jnz     SHORT .CheckNextFlag
    196201    MIN_U   al, 6                       ; Make sure not above lookup tables
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm

    r589 r592  
    150150    push    bp
    151151    mov     bp, sp
     152%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
     153%if DRVDETECTINFO.szDrvName = 0
     154    push    bx
     155%else
    152156    lea     si, [bx+DRVDETECTINFO.szDrvName]
    153157    push    si
     158%endif
     159%endif
    154160    mov     si, g_szDriveName
    155161    jmp     SHORT DetectPrint_FormatCSSIfromParamsInSSBP
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm

    r567 r592  
    190190    LOAD_BDA_SEGMENT_TO ds, ax
    191191    mov     al, [BDA.wEquipment]    ; Load Equipment WORD low byte
     192    and     al, 0C1h                ; Leave bits 7..6 and 0
     193    eAAM    64
     194    add     al, ah                  ; AL = Floppy Drive count
    192195    pop     ds
    193 
    194 %ifdef USE_UNDOC_INTEL
    195     and     al, 0C1h
    196     eAAM    64
    197 %else
    198     mov     ah, al                  ; Copy it to AH
    199     and     ax, 0C001h              ; Leave bits 15..14 and 0
    200     eROL_IM ah, 2                   ; EW low byte bits 7..6 to 1..0
    201 %endif ; USE_UNDOC_INTEL
    202 
    203     add     al, ah                  ; AL = Floppy Drive count
    204196%endif ; USE_AT
    205197
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm

    r589 r592  
    239239.ClearBitFrom8259MaskRegister:
    240240    push    cx
    241     xchg    ax, cx              ; IRQ index to CL
     241    xchg    cx, ax              ; IRQ index to CL
     242    in      al, dx              ; Read Interrupt Mask Register
    242243    mov     ch, ~1              ; Load bit mask to be rotated
    243244    rol     ch, cl              ; Rotate mask to correct position for clearing
    244     in      al, dx              ; Read Interrupt Mask Register
    245245    and     al, ch              ; Clear wanted bit
    246246    out     dx, al              ; Write modified Interrupt Mask Register
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r589 r592  
    3232
    3333    ; We must define included libraries before including "AssemblyLibrary.inc".
    34 %define EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS   ; Exclude unused library functions
     34%define EXCLUDE_FROM_XUB                    ; Exclude unused library functions
    3535%ifdef MODULE_BOOT_MENU
    3636    %define MENUEVENT_INLINE_OFFSETS        ; Only one menu required, save space and inline offsets
     
    8181%ifdef MODULE_BOOT_MENU
    8282    at  ROMVARS.wBootTimeout,   dw  BOOT_MENU_DEFAULT_TIMEOUT
     83    at  ROMVARS.pColorTheme,    dw  ColorTheme              ; Offset to the ATTRIBUTE_CHARS struc that holds the color theme
    8384%endif
    8485    at  ROMVARS.bIdeCnt,        db  2                       ; Number of supported controllers
     
    105106    at  ROMVARS.ideVars2+IDEVARS.wControlBlockPort, dw  DEVICE_ATA_TERTIARY_PORTCTRL
    106107    at  ROMVARS.ideVars2+IDEVARS.bDevice,           db  DEVICE_16BIT_ATA
    107     at  ROMVARS.ideVars2+IDEVARS.bIRQ,              db  0
     108    at  ROMVARS.ideVars2+IDEVARS.bIRQ,              db  0   ; Should be 11 on the GSI Inc. Model 2C
    108109    at  ROMVARS.ideVars2+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  dw  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    109110    at  ROMVARS.ideVars2+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   dw  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
     
    112113    at  ROMVARS.ideVars3+IDEVARS.wControlBlockPort, dw  DEVICE_ATA_QUATERNARY_PORTCTRL
    113114    at  ROMVARS.ideVars3+IDEVARS.bDevice,           db  DEVICE_16BIT_ATA
    114     at  ROMVARS.ideVars3+IDEVARS.bIRQ,              db  0
     115    at  ROMVARS.ideVars3+IDEVARS.bIRQ,              db  0   ; Should be 10 on the GSI Inc. Model 2C
    115116    at  ROMVARS.ideVars3+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  dw  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    116117    at  ROMVARS.ideVars3+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   dw  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
     
    127128%ifdef MODULE_BOOT_MENU
    128129    at  ROMVARS.wBootTimeout,   dw  BOOT_MENU_DEFAULT_TIMEOUT
     130    at  ROMVARS.pColorTheme,    dw  ColorTheme              ; Offset to the ATTRIBUTE_CHARS struc that holds the color theme
    129131%endif
    130132    at  ROMVARS.bIdeCnt,        db  1
     
    301303
    302304
     305%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
    303306; Although it's very unlikely to happen, we give warnings for builds that cannot be automatically checksummed due to the size being too large.
    304307; In some cases it's theoretically possible to checksum the build anyway (manually) which is why these are warnings and not errors.
     
    309312        %endif
    310313    %endif
    311 %elif ($-$$) = BIOS_SIZE            ; A large build.
     314%elif ($-$$) = BIOS_SIZE            ; A large or tiny build.
    312315    %warning "This build is too large to be auto-checksummed!"
    313316%endif
     317%endif
  • trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuEvent.asm

    r567 r592  
    141141
    142142    ; Store default Menuitem (=default drive to boot from)
    143     eMOVZX  dx, BYTE [cs:ROMVARS.bBootDrv]
     143    eMOVZX  dx, [cs:ROMVARS.bBootDrv]
    144144    call    GetMenuitemToDXforDriveInDL
    145145    mov     [bp+MENUINIT.wHighlightedItem], dx
  • trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuPrint.asm

    r589 r592  
    5454    test    dl, dl
    5555    js      SHORT .go
    56     mov     bl, ((g_szFloppyDrv)-$$ & 0xff)         ; and revisit the earlier assumption...
     56    mov     bl, (g_szFloppyDrv - $$) & 0xff         ; and revisit the earlier assumption...
    5757
    5858.go:
  • trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuPrintCfg.asm

    r568 r592  
    6363    ;; with AL clear, and so we exchange AL and AH after the multiply for the final result.
    6464    ;;
     65%ifdef USE_186
     66    imul    ax, g_szAddressingModes_Displacement << (8-TRANSLATEMODE_FIELD_POSITION)
     67%else
    6568    mov     cx, g_szAddressingModes_Displacement << (8-TRANSLATEMODE_FIELD_POSITION)
    6669    mul     cx
     70%endif
    6771    xchg    al, ah      ; AL = always zero after above multiplication
    6872    add     ax, g_szAddressingModes
  • trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm

    r568 r592  
    407407    sbb     di, BYTE 1              ; Sub CF if Floppy Drive
    408408    xchg    ax, cx
    409     mov     [es:di], al
     409    stosb
    410410    stc                             ; Valid hotkey scancode returned in AL
    411411
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AtaGeometry.asm

    r580 r592  
    114114    ; slower. The speed difference doesn't matter on AT systems.
    115115.UseAssistedLBA:
    116     call    GetSectorCountToDXAXfromCHSinAXBLBH
    117     call    ConvertChsSectorCountFromDXAXtoLbaAssistedLCHSinAXBLBH
    118     xor     cx, cx      ; No bits to shift
     116    ; Fall to GetSectorCountToDXAXfromCHSinAXBLBH
     117
     118
     119;--------------------------------------------------------------------
     120; GetSectorCountToDXAXfromCHSinAXBLBH
     121;   Parameters:
     122;       AX:     Number of cylinders (1...16383)
     123;       BL:     Number of heads (1...255)
     124;       BH:     Number of sectors per track (1...63)
     125;   Returns:
     126;       DX:AX:  Total number of CHS addressable sectors
     127;   Corrupts registers:
     128;       BX
     129;--------------------------------------------------------------------
     130GetSectorCountToDXAXfromCHSinAXBLBH:
     131    xchg    ax, bx
     132    mul     ah          ; AX = Heads * Sectors per track
     133    mul     bx
     134    ; Fall to ConvertChsSectorCountFromDXAXtoLbaAssistedLCHSinAXBLBH
     135
     136
     137;--------------------------------------------------------------------
     138; LBA assist calculation (or Assisted LBA)
     139;
     140; This algorithm translates P-CHS sector count up to largest possible
     141; L-CHS sector count (1024, 255, 63). Note that INT 13h interface allows
     142; 256 heads but DOS supports up to 255 head. That is why BIOSes never
     143; use 256 heads.
     144;
     145; L-CHS parameters generated here require the drive to use LBA addressing.
     146;
     147; Here is the algorithm:
     148; If cylinders > 8192
     149;  Variable CH = Total CHS Sectors / 63
     150;  Divide (CH - 1) by 1024 and add 1
     151;  Round the result up to the nearest of 16, 32, 64, 128 and 255. This is the value to be used for the number of heads.
     152;  Divide CH by the number of heads. This is the value to be used for the number of cylinders.
     153;
     154; ConvertChsSectorCountFromDXAXtoLbaAssistedLCHSinAXBLBH:
     155;   Parameters:
     156;       DX:AX:  Total number of P-CHS sectors for CHS addressing
     157;               (max = 16383 * 16 * 63 = 16,514,064)
     158;   Returns:
     159;       AX:     Number of cylinders (?...1027)
     160;       BL:     Number of heads (16, 32, 64, 128 or 255)
     161;       BH:     Number of sectors per track (always 63)
     162;       CX:     Number of bits shifted (0)
     163;       DL:     TRANSLATEMODE_ASSISTED_LBA
     164;   Corrupts registers:
     165;       DH
     166;--------------------------------------------------------------------
     167ConvertChsSectorCountFromDXAXtoLbaAssistedLCHSinAXBLBH:
     168    ; Value CH = Total sector count / 63
     169    ; Max = 16,514,064 / 63 = 262128
     170    mov     cx, LBA_ASSIST_SPT          ; CX = 63
     171
     172    ; --- Math_DivDXAXbyCX inlined (and slightly modified) since it's only used here
     173    xor     bx, bx
     174    xchg    bx, ax
     175    xchg    dx, ax
     176    div     cx
     177    xchg    ax, bx
     178    div     cx
     179    mov     dx, bx
     180    ; ---
     181
     182    push    ax
     183    push    dx                          ; Value CH stored for later use
     184
     185    ; BX:DX:AX = Value CH - 1
     186    ; Max = 262128 - 1 = 262127
     187    xor     bx, bx
     188    sub     ax, BYTE 1
     189    sbb     dx, bx
     190
     191    ; AX = Number of heads = ((Value CH - 1) / 1024) + 1
     192    ; Max = (262127 / 1024) + 1 = 256
     193    call    Size_DivideSizeInBXDXAXby1024   ; Preserves CX and returns with BH cleared
     194    pop     dx
     195    inc     ax                          ; + 1
     196
     197    ; Heads must be 16, 32, 64, 128 or 255 (round up to the nearest)
     198    ; Max = 255
     199    mov     bl, 16                      ; Min number of heads
     200.CompareNextValidNumberOfHeads:
     201    cmp     ax, bx
     202    jbe     SHORT .NumberOfHeadsNowInBX
     203    eSHL_IM bx, 1                       ; Double number of heads
     204    jpo     SHORT .CompareNextValidNumberOfHeads    ; Reached 256 heads?
     205    dec     bx                          ;  If so, limit heads to 255
     206.NumberOfHeadsNowInBX:
     207
     208    ; DX:AX = Number of cylinders = Value CH (without - 1) / number of heads
     209    ; Max = 262128 / 255 = 1027
     210    pop     ax                          ; Value CH back to DX:AX
     211    div     bx
     212
     213    xchg    bh, cl                      ; Sectors per Track to BH, zero to CL (CX)
    119214    mov     dl, TRANSLATEMODE_ASSISTED_LBA
     215ReturnLCHSinAXBLBH:
    120216    ret
    121217
     
    136232    mov     bl, [es:si+ATA1.wHeadCnt]   ; Heads (1...16)
    137233    mov     bh, [es:si+ATA1.wSPT]       ; Sectors per Track (1...63)
    138     ret
    139 
    140 
    141 ;--------------------------------------------------------------------
    142 ; GetSectorCountToDXAXfromCHSinAXBLBH
    143 ;   Parameters:
    144 ;       AX:     Number of cylinders (1...16383)
    145 ;       BL:     Number of heads (1...255)
    146 ;       BH:     Number of sectors per track (1...63)
    147 ;   Returns:
    148 ;       DX:AX:  Total number of CHS addressable sectors
    149 ;   Corrupts registers:
    150 ;       BX
    151 ;--------------------------------------------------------------------
    152 GetSectorCountToDXAXfromCHSinAXBLBH:
    153     xchg    ax, bx
    154     mul     ah          ; AX = Heads * Sectors per track
    155     mul     bx
    156234    ret
    157235
     
    175253;  Do a standard ECHS translation
    176254;
     255; *FIXME* The above algorithm seems to be conflicting with info found here
     256; https://web.archive.org/web/20000817071418/http://www.firmware.com:80/support/bios/over4gb.htm
     257; which says that Revised ECHS is used when the cylinder count is > 8191.
     258;
    177259; ConvertPCHfromAXBLtoRevisedEnhancedCHinAXBL:
    178260;   Parameters:
     
    183265;       BL:     Number of L-CHS heads (?...240)
    184266;       CX:     Number of bits shifted (0...3)
    185 ;       DX:     ADDRESSING_MODE_NORMAL or ADDRESSING_MODE_LARGE
     267;       DX:     TRANSLATEMODE_NORMAL or TRANSLATEMODE_LARGE
    186268;   Corrupts registers:
    187269;       Nothing
     
    271353    ret
    272354
    273 
    274 ;--------------------------------------------------------------------
    275 ; LBA assist calculation (or Assisted LBA)
    276 ;
    277 ; This algorithm translates P-CHS sector count up to largest possible
    278 ; L-CHS sector count (1024, 255, 63). Note that INT 13h interface allows
    279 ; 256 heads but DOS supports up to 255 head. That is why BIOSes never
    280 ; use 256 heads.
    281 ;
    282 ; L-CHS parameters generated here require the drive to use LBA addressing.
    283 ;
    284 ; Here is the algorithm:
    285 ; If cylinders > 8192
    286 ;  Variable CH = Total CHS Sectors / 63
    287 ;  Divide (CH – 1) by 1024 and add 1
    288 ;  Round the result up to the nearest of 16, 32, 64, 128 and 255. This is the value to be used for the number of heads.
    289 ;  Divide CH by the number of heads. This is the value to be used for the number of cylinders.
    290 ;
    291 ; ConvertChsSectorCountFromDXAXtoLbaAssistedLCHSinAXBLBH:
    292 ;   Parameters:
    293 ;       DX:AX:  Total number of P-CHS sectors for CHS addressing
    294 ;               (max = 16383 * 16 * 63 = 16,514,064)
    295 ;   Returns:
    296 ;       AX:     Number of cylinders (?...1027)
    297 ;       BL:     Number of heads (16, 32, 64, 128 or 255)
    298 ;       BH:     Number of sectors per track (always 63)
    299 ;   Corrupts registers:
    300 ;       CX, DX
    301 ;--------------------------------------------------------------------
    302 ConvertChsSectorCountFromDXAXtoLbaAssistedLCHSinAXBLBH:
    303     ; Value CH = Total sector count / 63
    304     ; Max = 16,514,064 / 63 = 262128
    305     mov     cx, LBA_ASSIST_SPT          ; CX = 63
    306     call    Math_DivDXAXbyCX            ; Preserves CX
    307     push    dx
    308     push    ax                          ; Value CH stored for later use
    309 
    310     ; BX:DX:AX = Value CH - 1
    311     ; Max = 262128 - 1 = 262127
    312     xor     bx, bx
    313     sub     ax, BYTE 1
    314     sbb     dx, bx
    315 
    316     ; AX = Number of heads = ((Value CH - 1) / 1024) + 1
    317     ; Max = (262127 / 1024) + 1 = 256
    318     call    Size_DivideSizeInBXDXAXby1024   ; Preserves CX
    319     inc     ax                          ; + 1
    320 
    321     ; Heads must be 16, 32, 64, 128 or 255 (round up to the nearest)
    322     ; Max = 255
    323     mov     cl, 16                      ; Min number of heads
    324 .CompareNextValidNumberOfHeads:
    325     cmp     ax, cx
    326     jbe     SHORT .NumberOfHeadsNowInCX
    327     eSHL_IM cx, 1                       ; Double number of heads
    328     jpo     SHORT .CompareNextValidNumberOfHeads    ; Reached 256 heads?
    329     dec     cx                          ;  If so, limit heads to 255
    330 .NumberOfHeadsNowInCX:
    331     mov     bx, cx                      ; Number of heads are returned in BL
    332     mov     bh, LBA_ASSIST_SPT          ; Sectors per Track
    333 
    334     ; DX:AX = Number of cylinders = Value CH (without - 1) / number of heads
    335     ; Max = 262128 / 255 = 1027
    336     pop     ax
    337     pop     dx                          ; Value CH back to DX:AX
    338     div     cx
    339 
    340     ; Return L-CHS
    341 ReturnLCHSinAXBLBH:
    342     ret
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/DrvDetectInfo.asm

    r591 r592  
    4646
    4747    add     si, BYTE ATA1.strModel              ; DS:SI now points drive name (Clears CF)
     48%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
    4849%if DRVDETECTINFO.szDrvName = 0
    4950    mov     di, bx
    5051%else
    5152    lea     di, [bx+DRVDETECTINFO.szDrvName]    ; ES:DI now points to name destination
     53%endif
    5254%endif
    5355    mov     cx, MAX_HARD_DISK_NAME_LENGTH / 2   ; Max number of WORDs allowed
     
    7880;--------------------------------------------------------------------
    7981DriveDetectInfo_ConvertDPTtoBX:
     82%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
    8083%if DPT_DRVDETECTINFO_SIZE_MULTIPLIER = 2
    8184%if BOOTVARS.rgDrvDetectInfo & 1                    ; Should never be odd but better safe than sorry
    82     lea     ax, [di-RAMVARS_size]
    83     eSHL_IM ax, 1
    84     add     ax, BOOTVARS.rgDrvDetectInfo
     85    lea     bx, [di-RAMVARS_size]
     86    eSHL_IM bx, 1
     87    add     bx, BOOTVARS.rgDrvDetectInfo
    8588%else
    86     lea     ax, [di-RAMVARS_size+(BOOTVARS.rgDrvDetectInfo/2)]
    87 ;   eSHL_IM ax, 1                                   ; *FIXME* For some reason this will cause NASM to crap itself.
    88     shl     ax, 1                                   ; So this will have to suffice for now.
     89    lea     bx, [di-RAMVARS_size+(BOOTVARS.rgDrvDetectInfo/2)]
     90    eSHL_IM bx, 1
    8991%endif
     92%else
     93%ifdef USE_186
     94    lea     bx, [di-RAMVARS_size]
     95    imul    bx, DPT_DRVDETECTINFO_SIZE_MULTIPLIER
     96    add     bx, BOOTVARS.rgDrvDetectInfo
    9097%else
    9198    lea     ax, [di-RAMVARS_size]                   ; subtract off base of DPTs
     
    93100    mul     bl
    94101    add     ax, BOOTVARS.rgDrvDetectInfo            ; add base of DRVDETECTINFO
     102    xchg    bx, ax
    95103%endif
    96     xchg    bx, ax
     104%endif
     105%endif
    97106    ret
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm

    r567 r592  
    3131;       DS:     RAMVARS segment
    3232;   Corrupts registers:
    33 ;       AX, CX, DI
     33;       AX, CX, DX, DI
    3434;--------------------------------------------------------------------
    3535RamVars_Initialize:
    3636    push    es
    37     ; Fall to .StealMemoryForRAMVARS
    3837
    39 ;--------------------------------------------------------------------
    40 ; .StealMemoryForRAMVARS
    41 ;   Parameters:
    42 ;       Nothing
    43 ;   Returns:
    44 ;       DS:     RAMVARS segment
    45 ;   Corrupts registers:
    46 ;       AX, CL
    47 ;--------------------------------------------------------------------
    48 .StealMemoryForRAMVARS:
    4938%ifndef USE_AT
    5039    mov     ax, LITE_MODE_RAMVARS_SEGMENT
     
    5645    mov     al, [cs:ROMVARS.bStealSize]
    5746    sub     [BDA.wBaseMem], ax
    58     mov     ax, [BDA.wBaseMem]
    5947%ifdef USE_186
    60     shl     ax, 6                       ; Segment to first stolen kB (*=40h)
     48    imul    ax, [BDA.wBaseMem], 64
    6149%else
    62     mov     cl, 6
    63     shl     ax, cl
     50    mov     al, 64
     51    mul     WORD [BDA.wBaseMem]
    6452%endif
    65     ; Fall to .InitializeRamvars
    6653
    67 ;--------------------------------------------------------------------
    68 ; .InitializeRamvars
    69 ;   Parameters:
    70 ;       AX:     RAMVARS segment
    71 ;   Returns:
    72 ;       DS:     RAMVARS segment
    73 ;   Corrupts registers:
    74 ;       AX, CX, DI, ES
    75 ;--------------------------------------------------------------------
    7654.InitializeRamvars:
     55    xor     di, di
    7756    mov     ds, ax
    7857    mov     es, ax
    7958    mov     cx, RAMVARS_size
    80     xor     di, di
    8159    call    Memory_ZeroESDIwithSizeInCX
    8260    mov     WORD [RAMVARS.wDrvDetectSignature], RAMVARS_DRV_DETECT_SIGNATURE
     
    12199.GetStolenSegmentToDS:
    122100    LOAD_BDA_SEGMENT_TO ds, di
     101;%ifdef USE_186
     102;   imul    di, [BDA.wBaseMem], 64  ; 2 bytes less but slower, especially on 386/486 processors
     103;%else
    123104    mov     di, [BDA.wBaseMem]      ; Load available base memory size in kB
    124105    eSHL_IM di, 6                   ; Segment to first stolen kB (*=40h)
     106;%endif
    125107ALIGN JUMP_ALIGN
    126108.LoopStolenKBs:
Note: See TracChangeset for help on using the changeset viewer.