Changeset 493 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src


Ignore:
Timestamp:
Dec 21, 2012, 8:44:25 AM (12 years ago)
Author:
gregli@…
google:author:
gregli@hotmail.com
Message:

Separated MODULE_8BIT_IDE into the basic part used by XTIDE rev 1 and rev 2 which is PIO based, and MODULE_8BIT_IDE_ADVANCED for JRIDE and XTCF support which requires memory mapping and/or DMA. This allows for creating an 8KB image with boot menu support (but no hotkeys) for the XTIDE rev 1. Cleaned up how we reset the drive translation information, ensuring it is properly set between boot attempt on a primary and secondary drive - as a result we clean it when needed, rather than trying to always keep it clean. Also fixed translation bugs in int13h.asm where I had previously missed converting some MODULE_HOTKEYS into MODULE_DRIVEXLATE.

Location:
trunk/XTIDE_Universal_BIOS/Src
Files:
16 edited

Legend:

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

    r480 r493  
    8787    call    Idepack_FakeToSSBP
    8888
    89 %ifdef MODULE_8BIT_IDE
     89%ifdef MODULE_8BIT_IDE_ADVANCED
    9090    ; Enable 8-bit PIO mode for 8-bit ATA and XT-CF
    9191    push    si
     
    9494    call    AH9h_SetModeFromALtoXTCF
    9595    pop     si
    96 %endif ; MODULE_8BIT_IDE
     96%endif ; MODULE_8BIT_IDE_ADVANCED
    9797
    9898    ; Prepare to output Identify Device command
     
    172172    cmp     bl, FLG_STATUS_DRQ              ; Data transfer started?
    173173    jne     SHORT .WaitUntilNonTransferCommandCompletes
    174 %ifdef MODULE_8BIT_IDE
     174%ifdef MODULE_8BIT_IDE_ADVANCED
    175175    cmp     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_MEMMAP
    176176    jae     SHORT JrIdeTransfer_StartWithCommandInAL    ; DEVICE_8BIT_XTCF_MEMMAP or DEVICE_8BIT_JRIDE_ISA
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIO.asm

    r491 r493  
    5858    je      SHORT .ReverseA0andA3fromRegisterIndexInDX
    5959    jb      SHORT .InputToALfromRegisterInDX    ; Standard IDE controllers and XTIDE rev 1
     60       
     61%ifdef MODULE_8BIT_IDE_ADVANCED
    6062    cmp     al, DEVICE_8BIT_JRIDE_ISA
    6163    jne     SHORT .ShlRegisterIndexInDX         ; All XT-CF modes
     
    6870    pop     ds
    6971    ret
    70 
     72%endif
     73       
    7174.ReverseA0andA3fromRegisterIndexInDX:
    7275    mov     dl, [cs:bx+g_rgbSwapA0andA3fromIdeRegisterIndex]
     
    103106    cmp     bl, DEVICE_8BIT_XTIDE_REV2
    104107    jbe     SHORT .OutputALtoControlBlockRegisterInDX   ; Standard IDE controllers and XTIDE rev 1
     108       
     109%ifdef MODULE_8BIT_IDE_ADVANCED
    105110    cmp     bl, DEVICE_8BIT_JRIDE_ISA
    106111    jne     SHORT .ShlRegisterIndexInDX     ; All XT-CF modes
     
    115120    eSHL_IM dx, 1
    116121    jmp     SHORT OutputALtoRegisterInDX
     122%endif
    117123
    118124.OutputALtoControlBlockRegisterInDX:
     
    141147    je      SHORT .ReverseA0andA3fromRegisterIndexInDX
    142148    jb      SHORT OutputALtoRegisterInDX    ; Standard IDE controllers and XTIDE rev 1
     149
     150%ifdef MODULE_8BIT_IDE_ADVANCED
    143151    cmp     bl, DEVICE_8BIT_JRIDE_ISA
    144152    jne     SHORT .ShlRegisterIndexInDX     ; All XT-CF modes
     
    154162    pop     ds
    155163    ret
    156 
     164%endif
     165       
    157166.ReverseA0andA3fromRegisterIndexInDX:
    158167    mov     bx, dx
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm

    r491 r493  
    218218    xchg    ax, bx                              ; Lookup table offset to AX
    219219    mov     bl, [di+DPT_ATA.bDevice]
    220 %ifdef MODULE_8BIT_IDE
     220%ifdef MODULE_8BIT_IDE_ADVANCED
    221221    mov     dl, bl
    222222%endif
     
    226226
    227227    ; Normalize pointer for PIO-transfers and convert to physical address for DMA transfers
    228 %ifdef MODULE_8BIT_IDE
     228%ifdef MODULE_8BIT_IDE_ADVANCED
    229229    cmp     dl, DEVICE_8BIT_XTCF_DMA
    230230    jb      SHORT IdeTransfer_NormalizePointerInESSI
     
    281281%endif                  ; 26    29/26
    282282    ret
    283 %endif ; MODULE_8BIT_IDE
     283%endif ; MODULE_8BIT_IDE_ADVANCED
    284284    ; Fall to IdeTransfer_NormalizePointerInESSI if no MODULE_8BIT_IDE
    285285
     
    308308        dw      IdePioBlock_ReadFromXtideRev1       ; 3, DEVICE_8BIT_XTIDE_REV1
    309309        dw      IdePioBlock_ReadFromXtideRev2       ; 4, DEVICE_8BIT_XTIDE_REV2
     310%ifdef MODULE_8BIT_IDE_ADVANCED
    310311        dw      IdePioBlock_ReadFrom8bitDataPort    ; 5, DEVICE_8BIT_XTCF_PIO8
    311312        dw      IdeDmaBlock_ReadFromXTCF            ; 6, DEVICE_8BIT_XTCF_DMA
     313%endif
    312314%endif
    313315
     
    320322        dw      IdePioBlock_WriteToXtideRev1        ; 3, DEVICE_8BIT_XTIDE_REV1
    321323        dw      IdePioBlock_WriteToXtideRev2        ; 4, DEVICE_8BIT_XTIDE_REV2
     324%ifdef MODULE_8BIT_IDE_ADVANCED     
    322325        dw      IdePioBlock_WriteTo8bitDataPort     ; 5, DEVICE_8BIT_XTCF_PIO8
    323326        dw      IdeDmaBlock_WriteToXTCF             ; 6, DEVICE_8BIT_XTCF_DMA
    324327%endif
     328%endif
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm

    r471 r493  
    9393    call    RamVars_GetSegmentToDS
    9494
    95 %ifdef MODULE_HOTKEYS
     95%ifdef MODULE_DRIVEXLATE
    9696    call    DriveXlate_ToOrBack
    9797    mov     [RAMVARS.xlateVars+XLATEVARS.bXlatedDrv], dl
     
    179179    mov     [bp+IDEPACK.intpack+INTPACK.si], si
    180180    mov     [bp+IDEPACK.intpack+INTPACK.bx], bx
    181 %ifdef MODULE_HOTKEYS
     181%ifdef MODULE_DRIVEXLATE
    182182    mov     [bp+IDEPACK.intpack+INTPACK.dh], dh
    183183%else
     
    190190    call    RamVars_GetSegmentToDS
    191191
    192 %ifdef MODULE_HOTKEYS
     192%ifdef MODULE_DRIVEXLATE
    193193    cmp     dl, [RAMVARS.xlateVars+XLATEVARS.bXlatedDrv]    ; DL is still drive number?
    194194    je      SHORT .ExchangeInt13hHandlers
     
    395395    dw  UnsupportedFunction                         ; 1Ch, ESDI Special Functions (PS/2)
    396396    dw  UnsupportedFunction                         ; 1Dh,
    397 %ifdef MODULE_8BIT_IDE
     397%ifdef MODULE_8BIT_IDE_ADVANCED
    398398    dw  AH1Eh_HandlerForXTCFfeatures                ; 1Eh, Lo-tech XT-CF features (XTIDE Universal BIOS)
    399399%else
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH23h_HFeatures.asm

    r474 r493  
    7676
    7777
    78 %ifdef MODULE_8BIT_IDE
    7978;--------------------------------------------------------------------
    8079; AH23h_Enable8bitPioMode
     
    8887;       AL, BX, CX, DX, SI
    8988;--------------------------------------------------------------------
     89%ifdef MODULE_8BIT_IDE
    9090AH23h_Enable8bitPioMode:
    9191    mov     si, FEATURE_ENABLE_8BIT_PIO_TRANSFER_MODE
    9292    jmp     SHORT AH23h_SetControllerFeatures
    93 %endif ; MODULE_8BIT_IDE
     93%endif
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.asm

    r491 r493  
    5959;--------------------------------------------------------------------
    6060AH24h_SetBlockSize:
    61 %ifdef MODULE_8BIT_IDE
     61%ifdef MODULE_8BIT_IDE_ADVANCED
    6262    ; XT-CF does not support largest block size in DMA mode.
    6363    cmp     al, XTCF_DMA_MODE_MAX_BLOCK_SIZE
     
    6666    je      SHORT AH1Eh_LoadInvalidCommandToAHandSetCF
    6767.NoNeedToLimitBlockSize:
    68 %endif ; MODULE_8BIT_IDE
     68%endif ; MODULE_8BIT_IDE_ADVANCED
    6969
    7070    push    bx
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm

    r480 r493  
    107107
    108108;;; Set XT-CF mode
    109 %ifdef MODULE_8BIT_IDE
     109%ifdef MODULE_8BIT_IDE_ADVANCED
    110110    call    AccessDPT_GetIdevarsToCSBX
    111111    mov     al, [cs:bx+IDEVARS.bXTCFcontrolRegister]
     
    113113    STORE_ERROR_FLAG_TO_DPT     FLG_INITERROR_FAILED_TO_SET_XTCF_MODE
    114114.DoNotSetXTCFmode:
    115 
    116 
     115%endif  ; MODULE_8BIT_IDE_ADVANCED
     116
     117%ifdef MODULE_8BIT_IDE
    117118;;; Set 8-bit PIO mode
    118119    call    AH9h_Enable8bitModeForDevice8bitAta
     
    266267
    267268
    268 %ifdef MODULE_8BIT_IDE
     269%ifdef MODULE_8BIT_IDE_ADVANCED
    269270;--------------------------------------------------------------------
    270271; AH9h_SetModeFromALtoXTCF
     
    284285    jne     SHORT IgnoreInvalidCommandError
    285286    jmp     AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL
    286 
    287 
     287%endif ; MODULE_8BIT_IDE_ADVANCED
     288
     289%ifdef MODULE_8BIT_IDE
    288290;--------------------------------------------------------------------
    289291; AH9h_Enable8bitModeForDevice8bitAta
     
    302304    jne     SHORT IgnoreInvalidCommandError
    303305    jmp     AH23h_Enable8bitPioMode
    304 %endif ; MODULE_8BIT_IDE
     306%endif
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm

    r492 r493  
    121121    call    HotkeyBar_ScanHotkeysFromKeyBufferAndStoreToBootvars       
    122122    cmp     al, ROM_BOOT_HOTKEY_SCANCODE
    123     jz      JumpToBootSector_or_RomBoot         ; CF clear so ROM boot
     123    jz      .RomBoot                            ; CF clear so ROM boot
    124124%ifdef MODULE_BOOT_MENU
    125125    cmp     al, BOOT_MENU_HOTKEY_SCANCODE
     
    135135.BootMenu:     
    136136    call    BootMenu_DisplayAndReturnDriveInDLRomBootClearCF
    137     jnc     JumpToBootSector_or_RomBoot         ; CF clear so ROM boot
     137    jnc     .RomBoot                            ; CF clear so ROM boot
    138138
    139139    mov     dh, dl                              ; Setup for secondary drive
     
    158158%endif
    159159
    160 %ifndef MODULE_BOOT_MENU
    161     clc     ;  fall through with flag for ROM boot.  Boot Menu goes back to menu and doesn't fall through.
    162 %endif     
     160.RomBoot:
     161%ifdef MODULE_DRIVEXLATE
     162    call    DriveXlate_Reset                    ; Clean up any drive mappings before Rom Boot
     163%endif
     164    clc     
     165    ;; fall through to JumpToBootSector_or_RomBoot
    163166
    164167;--------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm

    r492 r493  
    162162;--------------------------------------------------------------------
    163163StartDetectionWithDriveSelectByteInBHandStringInCX:
    164 %ifdef MODULE_8BIT_IDE
     164%ifdef MODULE_8BIT_IDE_ADVANCED
    165165    ; Autodetect port for XT-CF
    166166    call    DetectDrives_DoesIdevarsInCSBPbelongToXTCF
     
    195195.SkipXTCFportDetection:
    196196    push    dx
    197 %endif ; MODULE_8BIT_IDE
     197%endif ; MODULE_8BIT_IDE_ADVANCED
    198198
    199199    call    DetectPrint_StartDetectWithMasterOrSlaveStringInCXandIdeVarsInCSBP
     
    203203%endif             
    204204       
    205 %ifdef MODULE_8BIT_IDE
     205%ifdef MODULE_8BIT_IDE_ADVANCED
    206206    pop     dx
    207207%endif
     
    282282
    283283
    284 %ifdef MODULE_8BIT_IDE
     284%ifdef MODULE_8BIT_IDE_ADVANCED
    285285;--------------------------------------------------------------------
    286286; DetectDrives_DoesIdevarsInCSBPbelongToXTCF
     
    303303NoSlaveDriveAvailable:
    304304    ret
    305 %endif ; MODULE_8BIT_IDE
     305%endif ; MODULE_8BIT_IDE_ADVANCED
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r492 r493  
    128128    at  ROMVARS.wBootTimeout,   dw  BOOT_MENU_DEFAULT_TIMEOUT
    129129%endif
     130%ifdef MODULE_8BIT_IDE_ADVANCED     
    130131    at  ROMVARS.bIdeCnt,        db  2                       ; Number of supported controllers
     132%else
     133    at  ROMVARS.bIdeCnt,        db  1
     134%endif
    131135    at  ROMVARS.bBootDrv,       db  80h                     ; Boot Menu default drive
    132136    at  ROMVARS.bMinFddCnt,     db  0                       ; Do not force minimum number of floppy drives
     
    140144    at  ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    141145
     146%ifdef MODULE_8BIT_IDE_ADVANCED
    142147    at  ROMVARS.ideVars1+IDEVARS.bXTCFcontrolRegister,  db  XTCF_8BIT_PIO_MODE
    143148    at  ROMVARS.ideVars1+IDEVARS.bDevice,               db  DEVICE_8BIT_XTCF_PIO8
    144149    at  ROMVARS.ideVars1+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    145150    at  ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
     151%else
     152    at  ROMVARS.ideVars1+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
     153    at  ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
     154%endif     
    146155
    147156    at  ROMVARS.ideVars2+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
     
    227236%endif
    228237    %include "IdeCommand.asm"
    229 %ifdef MODULE_8BIT_IDE
     238%ifdef MODULE_8BIT_IDE_ADVANCED
    230239    %include "JrIdeTransfer.asm"    ; Must be included after IdeCommand.asm
    231240    %include "IdeDmaBlock.asm"
     
    261270    %include "AH11h_HRecal.asm"     ; Required by Int13h_Jump.asm
    262271    %include "AH15h_HSize.asm"      ; Required by Int13h_Jump.asm
    263 %ifdef MODULE_8BIT_IDE
     272%ifdef MODULE_8BIT_IDE_ADVANCED
    264273    %include "AH1Eh_XTCF.asm"
    265274%endif
  • trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuEvent.asm

    r492 r493  
    161161EventItemHighlightedFromCX:
    162162    push    cx
    163     call    DriveXlate_Reset       
    164163    call    BootMenu_GetDriveToDXforMenuitemInCX       
    165164    jnc     .noDriveSwap       
     
    209208;--------------------------------------------------------------------
    210209CloseBootMenu:
    211     call    DriveXlate_Reset
    212210    CALL_MENU_LIBRARY   Close
    213211    ; Fall to BootMenuEvent_Completed
  • trunk/XTIDE_Universal_BIOS/Src/Menus/DriveXlate.asm

    r492 r493  
    144144;       Nothing
    145145;   Corrupts registers:
    146 ;       Nothing
     146;       AX, DI, DL
    147147;--------------------------------------------------------------------
    148148DriveXlate_Reset:
    149     mov     WORD [RAMVARS.xlateVars+XLATEVARS.wFDandHDswap], 8000h
    150     ret
    151 
     149    xor     dl, dl              ; no translation for a floppy
     150    ;; fall through to DriveXlate_SetDriveToSwap
    152151
    153152;--------------------------------------------------------------------
     
    161160;       Nothing
    162161;   Corrupts registers:
    163 ;       Nothing
     162;       AX, DI
    164163;--------------------------------------------------------------------
    165164DriveXlate_SetDriveToSwap:
     165    mov     ax, 8000h           ; Default mapping (no translation)
    166166    test    dl, dl              ; Floppy drive?
    167167    js      SHORT .SetHardDriveToSwap
    168 
    169     ; Set Floppy Drive to swap
    170     mov     [RAMVARS.xlateVars+XLATEVARS.bFDSwap], dl
     168    mov     al, dl              ; Store floppy translation
     169    SKIP2B  di
     170.SetHardDriveToSwap:   
     171    mov     ah, dl              ; Store HD translation
     172    mov     WORD [RAMVARS.xlateVars+XLATEVARS.wFDandHDswap], ax
    171173    ret
    172 
    173 .SetHardDriveToSwap:
    174     mov     [RAMVARS.xlateVars+XLATEVARS.bHDSwap], dl
    175     ret
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm

    r491 r493  
    104104
    105105
    106 %ifdef MODULE_8BIT_IDE
     106%ifdef MODULE_8BIT_IDE_ADVANCED
    107107;--------------------------------------------------------------------
    108108; AccessDPT_IsThisDeviceXTCF
     
    125125.DeviceIsXTCF:
    126126    ret
    127 %endif ; MODULE_8BIT_IDE
     127%endif ; MODULE_8BIT_IDE_ADVANCED
    128128
    129129
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/BootVars.asm

    r492 r493  
    3232;--------------------------------------------------------------------
    3333BootVars_Initialize:
    34 %ifdef MODULE_8BIT_IDE
     34%ifdef MODULE_8BIT_IDE_ADVANCED
    3535    mov     WORD [es:BOOTVARS.wNextXTCFportToScan], XTCF_BASE_PORT_DETECTION_SEED
    3636%endif
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm

    r473 r493  
    245245    mov     [di+DPT.bIdevarsOffset], bp     ; IDEVARS must start in first 256 bytes of ROM
    246246
    247 %ifdef MODULE_8BIT_IDE
     247%ifdef MODULE_8BIT_IDE_ADVANCED
    248248    call    DetectDrives_DoesIdevarsInCSBPbelongToXTCF
    249249    jne     SHORT .DeviceUsesPortSpecifiedInIDEVARS
     
    251251    ret
    252252.DeviceUsesPortSpecifiedInIDEVARS:
    253 %endif ; MODULE_8BIT_IDE
     253%endif ; MODULE_8BIT_IDE_ADVANCED
    254254
    255255    mov     ax, [cs:bp+IDEVARS.wBasePort]
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm

    r492 r493  
    9494    mov     [RAMVARS.wNewStackOffset], ax
    9595%endif
    96     ; Fall to .InitializeDriveTranslationAndReturn
    97 
    98 ;--------------------------------------------------------------------
    99 ; .InitializeDriveTranslationAndReturn
    100 ;   Parameters:
    101 ;       DS:     RAMVARS segment
    102 ;   Returns:
    103 ;       Nothing
    104 ;   Corrupts registers:
    105 ;       AX
    106 ;--------------------------------------------------------------------
    107 .InitializeDriveTranslationAndReturn:
     96
     97;; There used to be a DriveXlate_Reset call here.  It isn't necessary, as we reset
     98;; when entering the boot menu and also before transferring control at boot time and
     99;; for ROM boots (in int19h.asm).
     100       
    108101    pop     es
    109 %ifdef MODULE_DRIVEXLATE
    110     jmp     DriveXlate_Reset
    111 %else
    112     ret
    113 %endif
    114 
     102    ret
    115103
    116104;--------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.