Changeset 238 in xtideuniversalbios


Ignore:
Timestamp:
Feb 5, 2012, 12:59:20 PM (13 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Makefile now builds small (8k) and large versions.
  • Completely untested support for JR-IDE/ISA.
Location:
trunk/XTIDE_Universal_BIOS
Files:
4 added
10 edited

Legend:

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

    r237 r238  
    1414
    1515    ; IDE Drive related
    16     ; .twLbaSectors is used for LBA addressing only.
    17     ; .wPchsCylinders and .bPchsSectors are used for CHS addressing only.
     16    ; .bLbaHeads and .twLbaSectors are used for LBA addressing only.
    1817    .bLbaHeads:                 resb    1   ; Number of LBA assisted heads (1...255)
    1918    .twLbaSectors               resb    2   ; 48-bit sector count for LBA addressing
     19
     20    ; .wPchsCylinders and .bPchsSectors are used for CHS addressing only.
    2021    .wPchsCylinders             resb    2   ; Number of P-CHS Cylinders (1...16383)
    2122    .wPchsHeadsAndSectors:
  • trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc

    r233 r238  
    9090DEVICE_32BIT_ATA                        EQU (4<<1)
    9191DEVICE_SERIAL_PORT                      EQU (5<<1)      ; must be last entry, or remove optimization in DetectPrint
     92DEVICE_JRIDE_ISA                        EQU (6<<1)
    9293
    9394
  • trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm

    r218 r238  
    44; Section containing code
    55SECTION .text
     6
     7
     8%macro TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE 1
     9    test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
     10    jnz     SHORT %1
     11%endmacro
     12
     13%macro CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE 1
     14    eMOVZX  bx, [di+DPT.bIdevarsOffset]
     15    cmp     BYTE [cs:bx+IDEVARS.bDevice], DEVICE_JRIDE_ISA
     16    je      SHORT %1
     17%endmacro
     18
     19%macro CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF 2
     20    cmp     BYTE [cs:bp+IDEVARS.bDevice], %1
     21    je      SHORT %2
     22%endmacro
     23
     24
    625
    726;--------------------------------------------------------------------
     
    1837%ifdef MODULE_SERIAL
    1938Device_FinalizeDPT:
    20     test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
    21     jnz     SHORT .FinalizeDptForSerialPortDevice
     39    TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE .FinalizeDptForSerialPortDevice
    2240    jmp     IdeDPT_Finalize
    23 
    2441.FinalizeDptForSerialPortDevice:
    2542    jmp     SerialDPT_Finalize
    26 %else
     43
     44%else   ; IDE or JR-IDE/ISA
    2745    Device_FinalizeDPT EQU IdeDPT_Finalize
    2846%endif
     
    3957;       AL, BX, CX, DX
    4058;--------------------------------------------------------------------
    41 %ifdef MODULE_SERIAL
     59%ifdef MODULE_JRIDE
     60    %ifdef MODULE_SERIAL                ; IDE + JR-IDE/ISA + Serial
     61    Device_ResetMasterAndSlaveController:
     62        TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort
     63        CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .ResetJrIDE
     64        jmp     IdeCommand_ResetMasterAndSlaveController
     65
     66    %else                               ; IDE + JR-IDE/ISA
     67    Device_ResetMasterAndSlaveController:
     68        CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .ResetJrIDE
     69        jmp     IdeCommand_ResetMasterAndSlaveController
     70    %endif
     71
     72%elifdef MODULE_SERIAL                  ; IDE + Serial
    4273Device_ResetMasterAndSlaveController:
    43     test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
    44     jnz     SHORT ReturnSuccessForSerialPort
     74    TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort
    4575    jmp     IdeCommand_ResetMasterAndSlaveController
    46 %else
     76
     77%else                                   ; IDE
    4778    Device_ResetMasterAndSlaveController EQU IdeCommand_ResetMasterAndSlaveController
     79%endif
     80
     81%ifdef MODULE_JRIDE
     82.ResetJrIDE:
     83    jmp     MemIdeCommand_ResetMasterAndSlaveController
    4884%endif
    4985
     
    6298;       AL, BL, CX, DX, SI, DI, ES
    6399;--------------------------------------------------------------------
    64 %ifdef MODULE_SERIAL
     100%ifdef MODULE_JRIDE
     101    %ifdef MODULE_SERIAL                ; IDE + JR-IDE/ISA + Serial
     102    Device_IdentifyToBufferInESSIwithDriveSelectByteInBH:
     103        CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF DEVICE_SERIAL_PORT, .IdentifyDriveFromSerialPort
     104        CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF DEVICE_JRIDE_ISA, .IdentifyDriveFromJrIde
     105        jmp     IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
     106
     107    %else                               ; IDE + JR-IDE/ISA
     108    Device_IdentifyToBufferInESSIwithDriveSelectByteInBH:
     109        CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF DEVICE_JRIDE_ISA, .IdentifyDriveFromJrIde
     110        jmp     IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
     111    %endif
     112
     113%elifdef MODULE_SERIAL                  ; IDE + Serial
    65114Device_IdentifyToBufferInESSIwithDriveSelectByteInBH:
    66     cmp     BYTE [cs:bp+IDEVARS.bDevice], DEVICE_SERIAL_PORT
    67     je      SHORT .IdentifyDriveFromSerialPort
     115    CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF DEVICE_SERIAL_PORT, .IdentifyDriveFromSerialPort
    68116    jmp     IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
    69117
     118%else                                   ; IDE
     119    Device_IdentifyToBufferInESSIwithDriveSelectByteInBH EQU IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
     120%endif
     121
     122%ifdef MODULE_JRIDE
     123.IdentifyDriveFromJrIde:
     124    jmp     MemIdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
     125%endif
     126
     127%ifdef MODULE_SERIAL
    70128.IdentifyDriveFromSerialPort:
    71129    jmp     SerialCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
    72 %else
    73     Device_IdentifyToBufferInESSIwithDriveSelectByteInBH EQU IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
    74130%endif
    75131
     
    89145;       AL, BX, CX, DX, (ES:SI for data transfer commands)
    90146;--------------------------------------------------------------------
    91 %ifdef MODULE_SERIAL
    92 ALIGN JUMP_ALIGN
     147%ifdef MODULE_JRIDE
     148    %ifdef MODULE_SERIAL                ; IDE + JR-IDE/ISA + Serial
     149    Device_OutputCommandWithParameters:
     150        TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE .OutputCommandToSerialPort
     151        CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .OutputCommandToJrIDE
     152        jmp     IdeCommand_OutputWithParameters
     153
     154    %else                               ; IDE + JR-IDE/ISA
     155    Device_OutputCommandWithParameters:
     156        CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .OutputCommandToJrIDE
     157        jmp     IdeCommand_OutputWithParameters
     158    %endif
     159
     160%elifdef MODULE_SERIAL                  ; IDE + Serial
    93161Device_OutputCommandWithParameters:
    94     test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
    95     jnz     SHORT .OutputCommandToSerialPort
     162    TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE .OutputCommandToSerialPort
    96163    jmp     IdeCommand_OutputWithParameters
    97164
     165%else                                   ; IDE
     166    Device_OutputCommandWithParameters EQU IdeCommand_OutputWithParameters
     167%endif
     168
     169%ifdef MODULE_JRIDE
     170ALIGN JUMP_ALIGN
     171.OutputCommandToJrIDE:
     172    jmp     MemIdeCommand_OutputWithParameters
     173%endif
     174
     175%ifdef MODULE_SERIAL
    98176ALIGN JUMP_ALIGN
    99177.OutputCommandToSerialPort:
    100178    jmp     SerialCommand_OutputWithParameters
    101 %else
    102     Device_OutputCommandWithParameters EQU IdeCommand_OutputWithParameters
    103179%endif
    104180
     
    115191;       AL, BX, CX, DX
    116192;--------------------------------------------------------------------
    117 %ifdef MODULE_SERIAL
    118 ALIGN JUMP_ALIGN
     193%ifdef MODULE_JRIDE
     194    %ifdef MODULE_SERIAL                ; IDE + JR-IDE/ISA + Serial
     195    Device_SelectDrive:
     196        TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort
     197        CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .SelectJrIdeDrive
     198        jmp     IdeCommand_SelectDrive
     199
     200    %else                               ; IDE + JR-IDE/ISA
     201    Device_SelectDrive:
     202        CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .SelectJrIdeDrive
     203        jmp     IdeCommand_SelectDrive
     204    %endif
     205
     206%elifdef MODULE_SERIAL                  ; IDE + Serial
    119207Device_SelectDrive:
    120     test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
    121     jnz     SHORT ReturnSuccessForSerialPort
     208    TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort
    122209    jmp     IdeCommand_SelectDrive
    123210
     211%else                                   ; IDE
     212    Device_SelectDrive EQU IdeCommand_SelectDrive
     213%endif
     214
     215%ifdef MODULE_JRIDE
     216ALIGN JUMP_ALIGN
     217.SelectJrIdeDrive:
     218    jmp     MemIdeCommand_SelectDrive
     219%endif
     220
     221%ifdef MODULE_SERIAL
     222ALIGN JUMP_ALIGN
    124223ReturnSuccessForSerialPort:
    125224    xor     ax, ax
    126225    ret
    127 %else
    128     Device_SelectDrive EQU IdeCommand_SelectDrive
    129 %endif
    130 
     226%endif
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm

    r218 r238  
    1515;       AL, BX, CX, DX
    1616;--------------------------------------------------------------------
    17 IdeCommand_ResetMasterAndSlaveController:
     17IDEDEVICE%+Command_ResetMasterAndSlaveController:
    1818    ; HSR0: Set_SRST
    1919    call    AccessDPT_GetDeviceControlByteToAL
    2020    or      al, FLG_DEVCONTROL_SRST | FLG_DEVCONTROL_nIEN   ; Set Reset bit
    21     mov     dl, DEVICE_CONTROL_REGISTER_out
    22     call    IdeIO_OutputALtoIdeControlBlockRegisterInDL
     21    OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER DEVICE_CONTROL_REGISTER_out
    2322    mov     ax, HSR0_RESET_WAIT_US
    2423    call    Timer_DelayMicrosecondsFromAX
     
    2827    or      al, FLG_DEVCONTROL_nIEN
    2928    and     al, ~FLG_DEVCONTROL_SRST                        ; Clear reset bit
    30     mov     dl, DEVICE_CONTROL_REGISTER_out
    31     call    IdeIO_OutputALtoIdeControlBlockRegisterInDL
     29    OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER DEVICE_CONTROL_REGISTER_out
    3230    mov     ax, HSR1_RESET_WAIT_US
    3331    call    Timer_DelayMicrosecondsFromAX
     
    3533    ; HSR2: Check_status
    3634    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_MOTOR_STARTUP, FLG_STATUS_BSY)
    37     jmp     IdeWait_PollStatusFlagInBLwithTimeoutInBH
     35    jmp     IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH
    3836
    3937
     
    5149;       AL, BL, CX, DX, SI, DI, ES
    5250;--------------------------------------------------------------------
    53 IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH:
     51IDEDEVICE%+Command_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH:
    5452    ; Create fake DPT to be able to use Device.asm functions
    5553    call    FindDPT_ForNewDriveToDSDI
     
    6664    jnz     SHORT .SkipLongWaitSinceDriveIsNotPrimaryMaster
    6765    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_MOTOR_STARTUP, FLG_STATUS_BSY)
    68     call    IdeWait_PollStatusFlagInBLwithTimeoutInBH
     66    call    IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH
    6967.SkipLongWaitSinceDriveIsNotPrimaryMaster:
    7068
     
    10098;--------------------------------------------------------------------
    10199ALIGN JUMP_ALIGN
    102 IdeCommand_OutputWithParameters:
     100IDEDEVICE%+Command_OutputWithParameters:
    103101    push    bx                      ; Store status register bits to poll
    104102
    105103    ; Select Master or Slave drive and output head number or LBA28 top bits
    106     call    IdeCommand_SelectDrive
     104    call    IDEDEVICE%+Command_SelectDrive
    107105    jc      SHORT .DriveNotReady
    108106
     
    119117    pop     ds
    120118.DoNotSetInterruptInServiceFlag:
    121     mov     dl, DEVICE_CONTROL_REGISTER_out
    122     call    IdeIO_OutputALtoIdeControlBlockRegisterInDL
     119    OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER DEVICE_CONTROL_REGISTER_out
    123120
    124121    ; Output Feature Number
    125     mov     dl, FEATURES_REGISTER_out
    126122    mov     al, [bp+IDEPACK.bFeatures]
    127     call    IdeIO_OutputALtoIdeRegisterInDL
     123    OUTPUT_AL_TO_IDE_REGISTER FEATURES_REGISTER_out
    128124
    129125    ; Output Sector Address High (only used by LBA48)
     
    138134
    139135    ; Output command
    140     mov     dl, COMMAND_REGISTER_out
    141136    mov     al, [bp+IDEPACK.bCommand]
    142     call    IdeIO_OutputALtoIdeRegisterInDL
     137    OUTPUT_AL_TO_IDE_REGISTER COMMAND_REGISTER_out
    143138
    144139    ; Wait until command completed
    145140    pop     bx                      ; Pop status and timeout for polling
    146141    cmp     bl, FLG_STATUS_DRQ      ; Data transfer started?
    147     je      SHORT IdeTransfer_StartWithCommandInAL
     142    je      SHORT IDEDEVICE%+Transfer_StartWithCommandInAL
    148143    test    BYTE [bp+IDEPACK.bDeviceControl], FLG_DEVCONTROL_nIEN
    149144    jz      SHORT .WaitForIrqOrRdy
    150     jmp     IdeWait_PollStatusFlagInBLwithTimeoutInBH
     145    jmp     IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH
    151146
    152147ALIGN JUMP_ALIGN
    153148.WaitForIrqOrRdy:
    154     jmp     IdeWait_IRQorStatusFlagInBLwithTimeoutInBH
     149    jmp     IDEDEVICE%+Wait_IRQorStatusFlagInBLwithTimeoutInBH
    155150
    156151.DriveNotReady:
    157152    pop     bx                          ; Clean stack
    158 ReturnSinceTimeoutWhenPollingBusy:
     153IDEDEVICE%+ReturnSinceTimeoutWhenPollingBusy:
    159154    ret
    160155
     
    172167;--------------------------------------------------------------------
    173168ALIGN JUMP_ALIGN
    174 IdeCommand_SelectDrive:
     169IDEDEVICE%+Command_SelectDrive:
    175170    ; Wait until neither Master or Slave Drive is busy
    176171    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY)
    177172    cmp     BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE
    178173    eCMOVE  bh, TIMEOUT_IDENTIFY_DEVICE
    179     call    IdeWait_PollStatusFlagInBLwithTimeoutInBH
    180     jc      SHORT ReturnSinceTimeoutWhenPollingBusy
     174    call    IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH
     175    jc      SHORT IDEDEVICE%+ReturnSinceTimeoutWhenPollingBusy
    181176
    182177    ; Select Master or Slave Drive
    183     mov     dl, DRIVE_AND_HEAD_SELECT_REGISTER
    184178    mov     al, [bp+IDEPACK.bDrvAndHead]
    185     call    IdeIO_OutputALtoIdeRegisterInDL
     179    OUTPUT_AL_TO_IDE_REGISTER DRIVE_AND_HEAD_SELECT_REGISTER
    186180    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY)
    187181    cmp     BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE
    188182    eCMOVE  bh, TIMEOUT_IDENTIFY_DEVICE
    189     jmp     IdeWait_PollStatusFlagInBLwithTimeoutInBH
     183    jmp     IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH
    190184
    191185
     
    203197;       AL, BX, DX
    204198;--------------------------------------------------------------------
     199%ifdef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS
    205200ALIGN JUMP_ALIGN
    206201OutputSectorCountAndAddress:
    207     mov     dl, SECTOR_COUNT_REGISTER
    208     call    IdeIO_OutputALtoIdeRegisterInDL
     202    OUTPUT_AL_TO_IDE_REGISTER SECTOR_COUNT_REGISTER
    209203
    210204    mov     al, ah
    211     mov     dl, LBA_LOW_REGISTER
    212     call    IdeIO_OutputALtoIdeRegisterInDL
     205    OUTPUT_AL_TO_IDE_REGISTER LBA_LOW_REGISTER
    213206
    214207    mov     al, cl
    215     mov     dl, LBA_MIDDLE_REGISTER
    216     call    IdeIO_OutputALtoIdeRegisterInDL
     208    OUTPUT_AL_TO_IDE_REGISTER LBA_MIDDLE_REGISTER
    217209
    218210    mov     al, ch
    219     mov     dl, LBA_HIGH_REGISTER
    220     jmp     IdeIO_OutputALtoIdeRegisterInDL
     211    JUMP_TO_OUTPUT_AL_TO_IDE_REGISTER LBA_HIGH_REGISTER
     212%endif
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeError.asm

    r160 r238  
    1818;--------------------------------------------------------------------
    1919ALIGN JUMP_ALIGN
    20 IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL:
     20IDEDEVICE%+Error_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL:
    2121    mov     ah, al          ; IDE Status Register to AH
    22     mov     dl, ERROR_REGISTER_in
    23     call    IdeIO_InputToALfromIdeRegisterInDL
     22    INPUT_TO_AL_FROM_IDE_REGISTER ERROR_REGISTER_in
    2423    xchg    al, ah          ; Status Register now in AL, Error Register now in AH
    2524
     
    4544;       BX
    4645;--------------------------------------------------------------------
     46%ifdef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS
    4747ALIGN JUMP_ALIGN
    4848GetBiosErrorCodeToAHfromStatusAndErrorRegistersInAX:
     
    9292    db  RET_HD_BADSECTOR    ; Bit7=BBK, Bad Block Detected
    9393    db  RET_HD_STATUSERR    ; When Error Register is zero
     94%endif
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIrq.asm

    r233 r238  
    111111    mov     bl, FLGH_DPT_INTERRUPT_IN_SERVICE
    112112    call    FindDPT_ToDSDIforFlagsHighInBL
    113     mov     dl, STATUS_REGISTER_in
    114     call    IdeIO_InputToALfromIdeRegisterInDL
     113    INPUT_TO_AL_FROM_IDE_REGISTER STATUS_REGISTER_in
    115114
    116115    ; Clear Interrupt In-Service Flag from DPT
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm

    r223 r238  
    9797.WriteLastBlockToDrive:
    9898    mov     cx, [bp+PIOVARS.wWordsLeft]
     99%ifdef USE_186
     100    push    CheckErrorsAfterTransferringLastBlock
     101    jmp     [bp+PIOVARS.fnXfer]                 ; Transfer possibly partial block
     102%else
    99103    call    [bp+PIOVARS.fnXfer]                 ; Transfer possibly partial block
    100 
    101     ; Check for errors in last block
    102     mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRDY)
    103     call    IdeWait_PollStatusFlagInBLwithTimeoutInBH
    104     jmp     SHORT ReturnWithTransferErrorInAH
     104    jmp     SHORT CheckErrorsAfterTransferringLastBlock
     105%endif
    105106
    106107
     
    155156    ; Check for errors in last block
    156157    mov     di, si                              ; DS:DI now points DPT
     158CheckErrorsAfterTransferringLastBlock:
    157159    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRDY)
    158160    call    IdeWait_PollStatusFlagInBLwithTimeoutInBH
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeWait.asm

    r160 r238  
    1616;       AL, BX, CX, DX
    1717;--------------------------------------------------------------------
    18 IdeWait_IRQorDRQ:
     18IDEDEVICE%+Wait_IRQorDRQ:
    1919    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ)
     20%ifdef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS     ; JR-IDE/ISA does not support IRQ
    2021    test    BYTE [bp+IDEPACK.bDeviceControl], FLG_DEVCONTROL_nIEN
    21     jnz     SHORT IdeWait_PollStatusFlagInBLwithTimeoutInBH ; Interrupt disabled
     22    jnz     SHORT IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH ; Interrupt disabled
     23%endif
    2224    ; Fall to IdeWait_IRQorStatusFlagInBLwithTimeoutInBH
    2325
     
    3537;       AL, BX, CX, DX
    3638;--------------------------------------------------------------------
    37 IdeWait_IRQorStatusFlagInBLwithTimeoutInBH:
     39IDEDEVICE%+Wait_IRQorStatusFlagInBLwithTimeoutInBH:
     40%ifdef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS     ; JR-IDE/ISA does not support IRQ
    3841    call    IdeIrq_WaitForIRQ
     42%endif
    3943    ; Always fall to IdeWait_PollStatusFlagInBLwithTimeoutInBH for error processing
    4044
     
    5256;       AL, BX, CX, DX
    5357;--------------------------------------------------------------------
    54 IdeWait_PollStatusFlagInBLwithTimeoutInBH:
     58IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH:
    5559    mov     ah, bl
    5660    mov     cl, bh
    5761    call    Timer_InitializeTimeoutWithTicksInCL
    5862    and     ah, ~FLG_STATUS_BSY
    59     jz      SHORT PollBsyOnly
     63    jz      SHORT IDEDEVICE%+PollBsyOnly
    6064    ; Fall to PollBsyAndFlgInAH
    6165
     
    7276;       AL, BX, CX, DX
    7377;--------------------------------------------------------------------
     78%ifdef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS
    7479PollBsyAndFlgInAH:
    75     call    ReadIdeStatusRegisterToAL           ; Discard contents for first read
     80    call    IDEDEVICE%+ReadIdeStatusRegisterToAL; Discard contents for first read
    7681ALIGN JUMP_ALIGN
    7782.PollLoop:
    78     call    ReadIdeStatusRegisterToAL
     83    call    IDEDEVICE%+ReadIdeStatusRegisterToAL
    7984    test    al, FLG_STATUS_BSY                  ; Controller busy?
    8085    jnz     SHORT .UpdateTimeout                ;  If so, jump to timeout update
    8186    test    al, ah                              ; Test secondary flag
    82     jnz     SHORT IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL
     87    jnz     SHORT IDEDEVICE%+Error_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL
    8388.UpdateTimeout:
    8489    call    Timer_SetCFifTimeout
    8590    jnc     SHORT .PollLoop                     ; Loop if time left
    86     call    IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL
     91    call    IDEDEVICE%+Error_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL
    8792    jc      SHORT .ReturnErrorCodeInAH
    8893    mov     ah, RET_HD_TIMEOUT                  ; Expected bit never got set
     
    9095.ReturnErrorCodeInAH:
    9196    ret
     97%endif
    9298
    9399
     
    103109;       AL, BX, CX, DX
    104110;--------------------------------------------------------------------
    105 PollBsyOnly:
    106     call    ReadIdeStatusRegisterToAL           ; Discard contents for first read
     111IDEDEVICE%+PollBsyOnly:
     112    call    IDEDEVICE%+ReadIdeStatusRegisterToAL; Discard contents for first read
    107113ALIGN JUMP_ALIGN
    108114.PollLoop:
    109     call    ReadIdeStatusRegisterToAL
     115    call    IDEDEVICE%+ReadIdeStatusRegisterToAL
    110116    test    al, FLG_STATUS_BSY                  ; Controller busy?
    111     jz      SHORT IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL
     117    jz      SHORT IDEDEVICE%+Error_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL
    112118    call    Timer_SetCFifTimeout                ; Update timeout counter
    113119    jnc     SHORT .PollLoop                     ; Loop if time left (sets CF on timeout)
    114     jmp     SHORT IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL
     120    jmp     SHORT IDEDEVICE%+Error_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL
    115121
    116122
     
    125131;--------------------------------------------------------------------
    126132ALIGN JUMP_ALIGN
    127 ReadIdeStatusRegisterToAL:
    128     mov     dl, STATUS_REGISTER_in
    129     jmp     IdeIO_InputToALfromIdeRegisterInDL
     133IDEDEVICE%+ReadIdeStatusRegisterToAL:
     134    JUMP_TO_INPUT_TO_AL_FROM_IDE_REGISTER STATUS_REGISTER_in
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r233 r238  
    186186
    187187    ; IDE Device support
     188%define IDEDEVICE Ide
     189%define ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS
     190    %include "IOMappedIDE.inc"      ; Assembly IDE support for normal I/O mapped controllers
    188191    %include "IdeCommand.asm"
    189192    %include "IdeTransfer.asm"      ; Must be included after IdeCommand.asm
     
    193196    %include "IdeIO.asm"
    194197    %include "IdeIrq.asm"
     198%undef IDEDEVICE
     199%undef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS
     200
     201    ; JR-IDE support
     202%ifdef MODULE_JRIDE
     203%define IDEDEVICE MemIde
     204    %include "MemMappedIDE.inc"     ; Assembly IDE support for memory mapped controllers
     205    %include "IdeCommand.asm"
     206    %include "MemIdeTransfer.asm"   ; Must be included after IdeCommand.asm
     207    %include "IdeWait.asm"
     208    %include "IdeError.asm"         ; Must be included after IdeWait.asm       
     209%undef IDEDEVICE
     210%endif
     211
    195212
    196213%ifdef MODULE_SERIAL                ; Serial Port Device support
  • trunk/XTIDE_Universal_BIOS/makefile

    r203 r238  
    4242HEADERS += Src/Device/
    4343HEADERS += Src/Device/IDE/
     44HEADERS += Src/Device/MemoryMappedIDE/
    4445HEADERS += Src/Device/Serial/
    4546HEADERS += Src/Initialization/
     
    6970DEFINES_XTPLUS = ELIMINATE_CGA_SNOW USE_186
    7071DEFINES_AT = USE_186 USE_286 USE_AT
     72DEFINES_XT_LARGE = $(DEFINES_XT) MODULE_JRIDE
     73DEFINES_XTPLUS_LARGE = $(DEFINES_XTPLUS) MODULE_JRIDE
     74DEFINES_AT_LARGE = $(DEFINES_AT) MODULE_JRIDE
    7175
    7276
     
    8084DEFS_XTPLUS = $(DEFINES_XTPLUS:%=-D%)
    8185DEFS_AT = $(DEFINES_AT:%=-D%)
     86DEFS_XT_LARGE = $(DEFINES_XT_LARGE:%=-D%)
     87DEFS_XTPLUS_LARGE = $(DEFINES_XTPLUS_LARGE:%=-D%)
     88DEFS_AT_LARGE = $(DEFINES_AT_LARGE:%=-D%)
    8289
    8390# Add -I in front of all header directories
     
    120127############################################
    121128
    122 .PHONY: all at xtplus xt clean
     129.PHONY: all at at_large xtplus xtplus_large xt xt_large clean
    123130
    124131# Make clean debug and release versions
    125 all: clean at xtplus xt
     132all: clean at at_large xtplus xtplus_large xt xt_large
    126133    @echo All done!
    127134
     
    130137    @echo AT version "$(TARGET)_at.bin" built.
    131138
     139at_large:
     140    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -l"$(TARGET)_atl.lst" -o"$(TARGET)_atl.bin"
     141    @echo Large AT version "$(TARGET)_atl.bin" built.
     142
    132143xtplus:
    133144    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -l"$(TARGET)_xtp.lst" -o"$(TARGET)_xtp.bin"
    134145    @echo XT plus version "$(TARGET)_xtp.bin" built.
    135146
     147xtplus_large:
     148    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS_LARGE) -l"$(TARGET)_xtpl.lst" -o"$(TARGET)_xtpl.bin"
     149    @echo Large XT plus version "$(TARGET)_xtpl.bin" built.
     150
    136151xt:
    137152    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -l"$(TARGET)_xt.lst" -o"$(TARGET)_xt.bin"
    138153    @echo XT version "$(TARGET)_xt.bin" built.
     154
     155xt_large:
     156    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -l"$(TARGET)_xtl.lst" -o"$(TARGET)_xtl.bin"
     157    @echo Large XT version "$(TARGET)_xtl.bin" built.
    139158
    140159clean:
Note: See TracChangeset for help on using the changeset viewer.