Changeset 152 in xtideuniversalbios


Ignore:
Timestamp:
May 1, 2011, 10:42:58 AM (13 years ago)
Author:
aitotat
google:author:
aitotat
Message:

Changes to XTIDE Universal BIOS:

  • XTIDE mod should now be supported (untested).
  • Interrupt Service Routine no longer requires variable from RAMVARS.
  • Some small improvements.
Location:
trunk/XTIDE_Universal_BIOS
Files:
15 edited
1 moved

Legend:

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

    r150 r152  
    4343FLG_DPT_SERIAL_DEVICE           EQU (1<<9)  ; Serial Port Device
    4444FLG_DPT_BLOCK_MODE_SUPPORTED    EQU (1<<10) ; Use block transfer commands
    45 
     45FLG_DPT_INTERRUPT_IN_SERVICE    EQU (1<<11) ; Set when waiting for IRQ
    4646FLG_DPT_RESET_nDRDY             EQU (1<<12) ; Drive ready to accept commands
    4747FLG_DPT_RESET_nINITPRMS         EQU (1<<13) ; Initialize Device Parameters successfull
  • trunk/XTIDE_Universal_BIOS/Inc/IDE_8bit.inc

    r150 r152  
    66
    77;--------------------------------------------------------------------
    8 ; Emulates INSW for XTIDE dual (8-bit) data port.
     8; Emulates INSW for XTIDE.
    99;
    10 ; eDUAL_BYTE_PORT_INSW
     10; XTIDE_INSW
    1111;   Parameters:
    1212;       BX:     Bit mask for toggling XTIDE data low/high reg
    13 ;       DX:     Port address (must be IDE Data Register)
     13;       DX:     XTIDE Data Low Register address
    1414;       ES:DI:  Ptr to destination buffer
    1515;   Returns:
     
    1818;       AL, FLAGS
    1919;--------------------------------------------------------------------
    20 %macro eDUAL_BYTE_PORT_INSW 0
     20%macro XTIDE_INSW 0
    2121%ifdef USE_186  ; INS instruction available
    2222    insb                        ; Load low byte from port DX to [ES:DI]
     
    3636
    3737;--------------------------------------------------------------------
    38 ; Emulates OUTSW for XTIDE dual (8-bit) data port.
     38; Emulates OUTSW for XTIDE.
    3939;
    40 ; eDUAL_BYTE_PORT_OUTSW
     40; XTIDE_OUTSW
    4141;   Parameters:
    4242;       BX:     Bit mask for toggling XTIDE data low/high reg
    43 ;       DX:     Port address (must be IDE Data Register)
     43;       DX:     XTIDE Data Low Register address
    4444;       DS:SI:  Ptr to source buffer
    4545;   Returns:
     
    4848;       AX, FLAGS
    4949;--------------------------------------------------------------------
    50 %macro eDUAL_BYTE_PORT_OUTSW 0
     50%macro XTIDE_OUTSW 0
    5151%ifdef USE_186  ; OUTS instruction available
    5252    lodsb                       ; Load low byte from [DS:SI] to AL
    5353    xor     dx, bx              ; IDE Data Reg to XTIDE Data High Reg
    5454    outsb                       ; Output high byte from [DS:SI]
    55     xor     dx, bx              ; IDE Data Reg to XTIDE Data Low Reg
     55    xor     dx, bx              ; XTIDE Data High Reg to Data Low Reg
    5656    out     dx, al              ; Output low byte from AL
    5757%else   ; If 8088/8086
     
    6060    xchg    al, ah              ; => AL=high byte, AH=low byte
    6161    out     dx, al              ; Output high byte
    62     xor     dx, bx              ; XTIDE Data High Reg to IDE Data Reg
     62    xor     dx, bx              ; XTIDE Data High Reg to Data Low Reg
     63    mov     al, ah              ; Copy low byte to AL
     64    out     dx, al              ; Output low byte
     65%endif
     66%endmacro
     67
     68
     69;--------------------------------------------------------------------
     70; Emulates OUTSW for modified XTIDE.
     71;
     72; XTIDE_MOD_OUTSW
     73;   Parameters:
     74;       DX:     XTIDE Data Low Register address
     75;       DS:SI:  Ptr to source buffer
     76;   Returns:
     77;       SI:     Incremented/decremented for next word
     78;   Corrupts registers:
     79;       AX, FLAGS
     80;--------------------------------------------------------------------
     81%macro XTIDE_MOD_OUTSW 0
     82%ifdef USE_186  ; OUTS instruction available
     83    lodsb                       ; Load low byte from [DS:SI] to AL
     84    inc     dx                  ; IDE Data Reg to XTIDE MOD Data High Reg
     85    outsb                       ; Output high byte from [DS:SI]
     86    dec     dx                  ; XTIDE Data High Reg to Data Low Reg
     87    out     dx, al              ; Output low byte from AL
     88%else   ; If 8088/8086
     89    lodsw                       ; Load word from [DS:SI]
     90    inc     dx                  ; IDE Data Reg to XTIDE MOD Data High Reg
     91    xchg    al, ah              ; => AL=high byte, AH=low byte
     92    out     dx, al              ; Output high byte
     93    dec     dx                  ; XTIDE Data High Reg to Data Low Reg
    6394    mov     al, ah              ; Copy low byte to AL
    6495    out     dx, al              ; Output low byte
  • trunk/XTIDE_Universal_BIOS/Inc/IntController.inc

    r145 r152  
    1 ; File name     :   Interrupts.inc
    2 ; Project name  :   IDE BIOS
    3 ; Created date  :   29.7.2007
    4 ; Last update   :   6.11.2009
    5 ; Author        :   Tomi Tilli
    6 ; Description   :   Equates for Interrupts.
    7 %ifndef INTERRUPTS_INC
    8 %define INTERRUPTS_INC
     1; Project name  :   XTIDE Universal BIOS
     2; Description   :   Equates for 8259 Interrupt Controllers.
     3%ifndef INT_CONTROLLER_INC
     4%define INT_CONTROLLER_INC
    95
    106; 8259 Master and Slave Interrupt Controller Ports
    11 RPORT_8259MA_IRR_ISR        EQU     20h     ; Master 8259 Read IRR / ISR
    12 WPORT_8259MA_COMMAND        EQU     20h     ; Master 8259 Write command
    13 WPORT_8259MA_INIT           EQU     21h     ; Master 8259 Write Init command
    14 PORT_8259MA_IMR             EQU     21h     ; Master 8259 IMR
    15 RPORT_8259SL_IRR_ISR        EQU     0A0h    ; Slave 8259 Read IRR / ISR
    16 WPORT_8259SL_COMMAND        EQU     0A0h    ; Slave 8259 Write command
    17 WPORT_8259SL_INIT           EQU     0A1h    ; Slave 8259 Write Init command
    18 PORT_8259SL_IMR             EQU     0A1h    ; Slave 8259 IMR
     7MASTER_8259_IRR_AND_ISR_in  EQU     20h     ; Interrupt Request Register / Interrupt In-Service Register
     8MASTER_8259_COMMAND_out     EQU     20h     ; Command output
     9MASTER_8259_IMR             EQU     21h     ; Interrupt Mask Register
     10MASTER_8259_INIT_out        EQU     21h     ; Initialization Command Parameters
     11SLAVE_8259_IRR_AND_ISR_in   EQU     0A0h    ; Interrupt Request Register / Interrupt In-Service Register
     12SLAVE_8259_COMMAND_out      EQU     0A0h    ; Command output
     13SLAVE_8259_IMR              EQU     0A1h    ; Interrupt Mask Register
     14SLAVE_8259_INIT_out         EQU     0A1h    ; Initialization Command Parameters
    1915
    20 ; Valid commands to port 20h (master, WPORT_8259MA_COMMAND)
    21 ; and A0h (slave, WPORT_8259SL_COMMAND)
    22 CMD_ROT_IN_AUTO_EOI_MODE_CLEAR  EQU     000h
    23 CMD_READ_IRR                    EQU     00Ah
    24 CMD_READ_ISR                    EQU     00Bh
    25 CMD_END_OF_INTERRUPT            EQU     020h
    26 CMD_NO_OPERATION                EQU     040h
    27 CMD_CLEAR_SPECIAL_MASK_MODE     EQU     048h
    28 CMD_SPEC_EOI_IRQ0               EQU     060h
    29 CMD_SPEC_EOI_IRQ1               EQU     061h
    30 CMD_SPEC_EOI_IRQ2               EQU     062h
    31 CMD_SPEC_EOI_IRQ3               EQU     063h
    32 CMD_SPEC_EOI_IRQ4               EQU     064h
    33 CMD_SPEC_EOI_IRQ5               EQU     065h
    34 CMD_SPEC_EOI_IRQ6               EQU     066h
    35 CMD_SPEC_EOI_IRQ7               EQU     067h
    36 CMD_SET_SPECIAL_MASK_MODE       EQU     068h
    37 CMD_ROT_IN_AUTO_EOI_MODE_SET    EQU     080h
    38 CMD_ROT_ON_NONSPEC_EOI          EQU     0A0h
    39 CMD_IRQ0_LOWST_PRIO             EQU     0C0h
    40 CMD_IRQ1_LOWST_PRIO             EQU     0C1h
    41 CMD_IRQ2_LOWST_PRIO             EQU     0C2h
    42 CMD_IRQ3_LOWST_PRIO             EQU     0C3h
    43 CMD_IRQ4_LOWST_PRIO             EQU     0C4h
    44 CMD_IRQ5_LOWST_PRIO             EQU     0C5h
    45 CMD_IRQ6_LOWST_PRIO             EQU     0C6h
    46 CMD_IRQ7_LOWST_PRIO             EQU     0C7h
    47 CMD_EOI_AND_IRQ0_LOWST_PRIO     EQU     0E0h
    48 CMD_EOI_AND_IRQ1_LOWST_PRIO     EQU     0E1h
    49 CMD_EOI_AND_IRQ2_LOWST_PRIO     EQU     0E2h
    50 CMD_EOI_AND_IRQ3_LOWST_PRIO     EQU     0E3h
    51 CMD_EOI_AND_IRQ4_LOWST_PRIO     EQU     0E4h
    52 CMD_EOI_AND_IRQ5_LOWST_PRIO     EQU     0E5h
    53 CMD_EOI_AND_IRQ6_LOWST_PRIO     EQU     0E6h
    54 CMD_EOI_AND_IRQ7_LOWST_PRIO     EQU     0E7h
     16; 8259 Interrupt Controller Commands
     17COMMAND_CLEAR_ROTATE_IN_AUTOMATIC_EOI_MODE  EQU     00h
     18COMMAND_READ_INTERRUPT_REQUEST_REGISTER     EQU     0Ah
     19COMMAND_READ_INTERRUPT_INSERVICE_REGISTER   EQU     0Bh
     20COMMAND_END_OF_INTERRUPT                    EQU     20h
     21COMMAND_NO_OPERATION                        EQU     40h
     22COMMAND_CLEAR_SPECIAL_MASK_MODE             EQU     48h
     23COMMAND_SPECIFIC_EOI_FOR_IR0                EQU     60h
     24COMMAND_SPECIFIC_EOI_FOR_IR1                EQU     61h
     25COMMAND_SPECIFIC_EOI_FOR_IR2                EQU     62h
     26COMMAND_SPECIFIC_EOI_FOR_IR3                EQU     63h
     27COMMAND_SPECIFIC_EOI_FOR_IR4                EQU     64h
     28COMMAND_SPECIFIC_EOI_FOR_IR5                EQU     65h
     29COMMAND_SPECIFIC_EOI_FOR_IR6                EQU     66h
     30COMMAND_SPECIFIC_EOI_FOR_IR7                EQU     67h
     31COMMAND_SET_SPECIAL_MASK_MODE               EQU     68h
     32COMMAND_SET_ROTATE_IN_AUTOMATIC_EOI_MODE    EQU     80h
     33COMMAND_ROTATE_ON_NONSPECIFIC_EOI           EQU     0A0h
     34COMMAND_IR0_LOWEST_PRIORITY                 EQU     0C0h
     35COMMAND_IR1_LOWEST_PRIORITY                 EQU     0C1h
     36COMMAND_IR2_LOWEST_PRIORITY                 EQU     0C2h
     37COMMAND_IR3_LOWEST_PRIORITY                 EQU     0C3h
     38COMMAND_IR4_LOWEST_PRIORITY                 EQU     0C4h
     39COMMAND_IR5_LOWEST_PRIORITY                 EQU     0C5h
     40COMMAND_IR6_LOWEST_PRIORITY                 EQU     0C6h
     41COMMAND_IR7_LOWEST_PRIORITY                 EQU     0C7h
     42COMMAND_EOI_AND_IR0_LOWEST_PRIORITY         EQU     0E0h
     43COMMAND_EOI_AND_IR1_LOWEST_PRIORITY         EQU     0E1h
     44COMMAND_EOI_AND_IR2_LOWEST_PRIORITY         EQU     0E2h
     45COMMAND_EOI_AND_IR3_LOWEST_PRIORITY         EQU     0E3h
     46COMMAND_EOI_AND_IR4_LOWEST_PRIORITY         EQU     0E4h
     47COMMAND_EOI_AND_IR5_LOWEST_PRIORITY         EQU     0E5h
     48COMMAND_EOI_AND_IR6_LOWEST_PRIORITY         EQU     0E6h
     49COMMAND_EOI_AND_IR7_LOWEST_PRIORITY         EQU     0E7h
    5550
    5651
    57 ; Interrupt Vector Table
    58 INTV_IRQ0                       EQU     08h     ; System timer
    59 INTV_IRQ1                       EQU     09h     ; Keyboard
    60 INTV_IRQ2                       EQU     0Ah
    61 INTV_IRQ3                       EQU     0Bh
    62 INTV_IRQ4                       EQU     0Ch
    63 INTV_IRQ5                       EQU     0Dh
    64 INTV_IRQ6                       EQU     0Eh
    65 INTV_IRQ7                       EQU     0Fh
    66 INTV_EQUIPMENT_CONF             EQU     11h     ; Equipment configuration
    67 INTV_MEMORY_SIZE                EQU     12h     ; Base memory size
    68 INTV_DISK_FUNC                  EQU     13h     ; Disk functions
    69 INTV_SYSTEM_SERVICES            EQU     15h     ; Different system functions
    70 INTV_KEYBOARD_FUNC              EQU     16h     ; Keyboard functions
    71 INTV_BOOT_FAILURE               EQU     18h     ; Process Boot Failure
    72 INTV_BOOTSTRAP                  EQU     19h     ; Boot Strap Loader
    73 INTV_TIME_OF_DAY                EQU     1Ah     ; Time of day functions
    74 INTV_KEYB_BREAK                 EQU     1Bh     ; Keyboard break
    75 INTV_USER_TIMER_TICK            EQU     1Ch     ; User timer tick
    76 INTV_DPT                        EQU     1Eh     ; Diskette Parameter Table
    77 INTV_FLOPPY_FUNC                EQU     40h     ; Floppy functions
    78 INTV_HD0DPT                     EQU     41h     ; Ptr to HD0 Disk Parameter Table
    79 INTV_HD1DPT                     EQU     46h     ; Ptr to HD1 Disk Parameter Table
    80 INTV_USERS_ALARM                EQU     4Ah     ; Users alarm
    81 INTV_IRQ8                       EQU     70h
    82 INTV_IRQ9                       EQU     71h
    83 INTV_IRQ10                      EQU     72h
    84 INTV_IRQ11                      EQU     73h
    85 INTV_IRQ12                      EQU     74h
    86 INTV_IRQ13                      EQU     75h
    87 INTV_IRQ14                      EQU     76h
    88 INTV_IRQ15                      EQU     77h
    89 
    90 
    91 %endif ; INTERRUPTS_INC
     52%endif ; INT_CONTROLLER_INC
  • trunk/XTIDE_Universal_BIOS/Inc/RamVars.inc

    r150 r152  
    2222    .fpOldI13h          resb    4   ; Far pointer to old INT 13h handler
    2323    .wTimeoutCounter    resb    2
    24     .pInServiceDPT      resb    2   ; Ptr to DPT for drive waiting for interrupt
    2524    .wSignature         resb    2   ; Sign for finding stolen 1 kiB
    2625
  • trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm

    r150 r152  
    7676ALIGN JUMP_ALIGN
    7777Device_OutputCommandWithParameters:
    78     call    IdeIrq_SetInServiceDPTandClearTaskFlag
    7978    test    WORD [di+DPT.wFlags], FLG_DPT_SERIAL_DEVICE
    8079    jnz     SHORT .OutputCommandToSerialPort
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm

    r150 r152  
    114114    mov     dl, DEVICE_CONTROL_REGISTER_out
    115115    mov     al, [bp+IDEPACK.bDeviceControl]
     116    test    al, FLG_DEVCONTROL_nIEN
     117    jnz     SHORT .DoNotSetInterruptInServiceFlag
     118    or      WORD [di+DPT.wFlags], FLG_DPT_INTERRUPT_IN_SERVICE
     119    push    ds
     120    LOAD_BDA_SEGMENT_TO ds, cx, !       ; Also zero CX
     121    mov     [BDA.bHDTaskFlg], al
     122    pop     ds
     123.DoNotSetInterruptInServiceFlag:
    116124    call    Device_OutputALtoIdeControlBlockRegisterInDL
    117125
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIrq.asm

    r150 r152  
    5050
    5151;--------------------------------------------------------------------
    52 ; IdeIrq_SetInServiceDPTandClearTaskFlag
    53 ;   Parameters:
    54 ;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    55 ;   Returns:
    56 ;       Nothing
    57 ;   Corrupts registers:
    58 ;       AX
    59 ;--------------------------------------------------------------------
    60 ALIGN JUMP_ALIGN
    61 IdeIrq_SetInServiceDPTandClearTaskFlag:
    62     mov     [RAMVARS.pInServiceDPT], di
    63     push    ds
    64     LOAD_BDA_SEGMENT_TO ds, ax, !       ; Also zero AX
    65     mov     [BDA.bHDTaskFlg], al
    66     pop     ds
    67     ret
    68 
    69 
    70 ;--------------------------------------------------------------------
    7152; IDE Interrupt Service Routines.
    7253;
     
    8667    call    AcknowledgeIdeInterruptAndSetTaskFlag
    8768
    88     mov     al, CMD_END_OF_INTERRUPT
     69    mov     al, COMMAND_END_OF_INTERRUPT
    8970    jmp     SHORT AcknowledgeMasterInterruptController
    9071
     
    9677    call    AcknowledgeIdeInterruptAndSetTaskFlag
    9778
    98     mov     al, CMD_END_OF_INTERRUPT    ; Load EOI command to AL
    99     out     WPORT_8259SL_COMMAND, al    ; Acknowledge Slave 8259
     79    mov     al, COMMAND_END_OF_INTERRUPT
     80    out     SLAVE_8259_COMMAND_out, al  ; Acknowledge Slave 8259
    10081AcknowledgeMasterInterruptController:
    101     out     WPORT_8259MA_COMMAND, al    ; Acknowledge Master 8259
     82    out     MASTER_8259_COMMAND_out, al ; Acknowledge Master 8259
    10283
    10384    ; Issue Int 15h, function AX=9100h (Interrupt ready)
     
    122103AcknowledgeIdeInterruptAndSetTaskFlag:
    123104    push    ds
     105    push    si
    124106    push    dx
    125107    push    bx
     
    127109    ; Reading Status Register acknowledges IDE interrupt
    128110    call    RamVars_GetSegmentToDS
    129     mov     di, [RAMVARS.pInServiceDPT]     ; DS:DI now points to DPT
     111    call    FindDPT_ToDSDIforInterruptInService
    130112    mov     dl, STATUS_REGISTER_in
    131113    call    Device_InputToALfromIdeRegisterInDL
     114
     115    ; Clear Interrupt In-Service Flag from DPT
     116    and     WORD [di+DPT.wFlags], ~FLG_DPT_INTERRUPT_IN_SERVICE
    132117
    133118    ; Set Task Flag
     
    137122    pop     bx
    138123    pop     dx
     124    pop     si
    139125    pop     ds
    140126    ret
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm

    r150 r152  
    213213
    214214;--------------------------------------------------------------------
    215 ; DualByteRead      Dual port 8-bit XTIDE PIO read transfer
    216 ; WordRead          Normal 16-bit IDE PIO read transfer
    217 ; DWordRead         VLB/PCI 32-bit IDE PIO read transfer
    218 ; SingleByteRead    Single port 8-bit PIO read transfer
     215; DualByteReadForXtide      Dual port 8-bit XTIDE PIO read transfer
     216; SingleByteRead            Single port 8-bit PIO read transfer
     217; WordReadForXTIDEmod       8088/8086 compatible 16-bit IDE PIO read transfer
     218; WordReadForXTplusAndAT    Normal 16-bit IDE PIO read transfer
     219; DWordRead                 VLB/PCI 32-bit IDE PIO read transfer
    219220;   Parameters:
    220221;       CX:     Block size in WORDs
     
    227228;--------------------------------------------------------------------
    228229ALIGN JUMP_ALIGN
    229 DualByteRead:
    230     times 2 shr cx, 1           ; Loop unrolling
    231     mov     bx, 8               ; Bit mask for toggling data low/high reg
     230DualByteReadForXtide:
     231    times 2 shr cx, 1   ; Loop unrolling
     232    mov     bx, 8       ; Bit mask for toggling data low/high reg
    232233ALIGN JUMP_ALIGN
    233234.InswLoop:
    234     eDUAL_BYTE_PORT_INSW
    235     eDUAL_BYTE_PORT_INSW
    236     eDUAL_BYTE_PORT_INSW
    237     eDUAL_BYTE_PORT_INSW
     235    XTIDE_INSW
     236    XTIDE_INSW
     237    XTIDE_INSW
     238    XTIDE_INSW
    238239    loop    .InswLoop
    239240    ret
    240241
    241 ALIGN JUMP_ALIGN
    242 WordRead:
    243     rep
    244     db      6Dh         ; INSW
    245     ret
    246 
    247 ALIGN JUMP_ALIGN
    248 DWordRead:
    249     shr     cx, 1       ; WORD count to DWORD count
    250     rep
    251     db      66h         ; Override operand size to 32-bit
    252     db      6Dh         ; INSW/INSD
    253     ret
    254 
     242;----
    255243ALIGN JUMP_ALIGN
    256244SingleByteRead:
    257245%ifdef USE_186  ; INS instruction available
    258     shl     cx, 1               ; WORD count to BYTE count
     246    shl     cx, 1       ; WORD count to BYTE count
    259247    rep insb
    260248%else           ; If 8088/8086
    261     shr     cx, 1               ; WORD count to DWORD count
     249    shr     cx, 1       ; WORD count to DWORD count
    262250ALIGN JUMP_ALIGN
    263251.InsdLoop:
    264252    in      al, dx
    265     stosb                       ; Store to [ES:DI]
     253    stosb               ; Store to [ES:DI]
    266254    in      al, dx
    267255    stosb
     
    274262    ret
    275263
    276 
    277 ;--------------------------------------------------------------------
    278 ; DualByteWrite     Dual port 8-bit XTIDE PIO write transfer
    279 ; WordWrite         Normal 16-bit IDE PIO write transfer
    280 ; DWordWrite        VLB/PCI 32-bit IDE PIO write transfer
    281 ; SingleByteWrite   Single port 8-bit PIO write transfer
     264;----
     265%ifndef USE_186
     266ALIGN JUMP_ALIGN
     267WordReadForXTIDEmod:
     268    times 2 shr cx, 1   ; WORD count to QWORD count
     269ALIGN JUMP_ALIGN
     270.ReadNextQword:
     271    in      ax, dx      ; Read 1st WORD
     272    stosw               ; Store 1st WORD to [ES:DI]
     273    in      ax, dx
     274    stosw               ; 2nd
     275    in      ax, dx
     276    stosw               ; 3rd
     277    in      ax, dx
     278    stosw               ; 4th
     279    loop    .ReadNextQword
     280    ret
     281%endif
     282
     283;----
     284ALIGN JUMP_ALIGN
     285WordReadForXTplusAndAT:
     286    rep
     287    db      6Dh         ; INSW (we want this in XT build)
     288    ret
     289
     290;----
     291ALIGN JUMP_ALIGN
     292DWordRead:
     293    shr     cx, 1       ; WORD count to DWORD count
     294    rep
     295    db      66h         ; Override operand size to 32-bit
     296    db      6Dh         ; INSW/INSD
     297    ret
     298
     299
     300;--------------------------------------------------------------------
     301; DualByteWriteForXtide     Dual port 8-bit XTIDE PIO write transfer
     302; SingleByteWrite           Single port 8-bit PIO write transfer
     303; WordWriteForXTIDEmod      8088/8086 compatible 16-bit IDE PIO read transfer
     304; WordWrite                 Normal 16-bit IDE PIO write transfer
     305; DWordWrite                VLB/PCI 32-bit IDE PIO write transfer
    282306;   Parameters:
    283307;       CX:     Block size in WORDs
     
    290314;--------------------------------------------------------------------
    291315ALIGN JUMP_ALIGN
    292 DualByteWrite:
     316DualByteWriteForXtide:
    293317    push    ds
    294318    push    bx
    295     times 2 shr cx, 1           ; Loop unrolling
    296     mov     bx, 8               ; Bit mask for toggling data low/high reg
    297     push    es                  ; Copy ES...
    298     pop     ds                  ; ...to DS
     319    times 2 shr cx, 1   ; Loop unrolling
     320    mov     bx, 8       ; Bit mask for toggling data low/high reg
     321    push    es          ; Copy ES...
     322    pop     ds          ; ...to DS
    299323ALIGN JUMP_ALIGN
    300324.OutswLoop:
    301     eDUAL_BYTE_PORT_OUTSW
    302     eDUAL_BYTE_PORT_OUTSW
    303     eDUAL_BYTE_PORT_OUTSW
    304     eDUAL_BYTE_PORT_OUTSW
     325    XTIDE_OUTSW
     326    XTIDE_OUTSW
     327    XTIDE_OUTSW
     328    XTIDE_OUTSW
    305329    loop    .OutswLoop
    306330    pop     bx
     
    308332    ret
    309333
    310 ALIGN JUMP_ALIGN
    311 WordWrite:
    312     eSEG    es          ; Source is ES segment
    313     rep
    314     db      6Fh         ; OUTSW
    315     ret
    316 
    317 ALIGN JUMP_ALIGN
    318 DWordWrite:
    319     shr     cx, 1       ; WORD count to DWORD count
    320     eSEG    es          ; Source is ES segment
    321     rep
    322     db      66h         ; Override operand size to 32-bit
    323     db      6Fh         ; OUTSW/OUTSD
    324     ret
    325 
     334;----
    326335ALIGN JUMP_ALIGN
    327336SingleByteWrite:
    328337%ifdef USE_186  ; OUTS instruction available
    329     shl     cx, 1               ; WORD count to BYTE count
    330     eSEG    es                  ; Source is ES segment
     338    shl     cx, 1       ; WORD count to BYTE count
     339    eSEG    es          ; Source is ES segment
    331340    rep outsb
    332341%else           ; If 8088/8086
    333     shr     cx, 1               ; WORD count to DWORD count
    334     push    ds                  ; Store DS
    335     push    es                  ; Copy ES...
    336     pop     ds                  ; ...to DS
     342    shr     cx, 1       ; WORD count to DWORD count
     343    push    ds          ; Store DS
     344    push    es          ; Copy ES...
     345    pop     ds          ; ...to DS
    337346ALIGN JUMP_ALIGN
    338347.OutsdLoop:
    339     lodsb                       ; Load from [DS:SI] to AL
     348    lodsb               ; Load from [DS:SI] to AL
    340349    out     dx, al
    341350    lodsb
     
    346355    out     dx, al
    347356    loop    .OutsdLoop
    348     pop     ds                  ; Restore DS
    349 %endif
    350     ret
     357    pop     ds          ; Restore DS
     358%endif
     359    ret
     360
     361;---
     362ALIGN JUMP_ALIGN
     363WordWriteForXTIDEmod:
     364    push    ds
     365    times 2 shr cx, 1   ; Loop unrolling
     366    push    es          ; Copy ES...
     367    pop     ds          ; ...to DS
     368ALIGN JUMP_ALIGN
     369.WriteNextQword:
     370    XTIDE_MOD_OUTSW
     371    XTIDE_MOD_OUTSW
     372    XTIDE_MOD_OUTSW
     373    XTIDE_MOD_OUTSW
     374    loop    .WriteNextQword
     375    pop     ds
     376    ret
     377
     378;----
     379ALIGN JUMP_ALIGN
     380WordWrite:
     381    eSEG    es          ; Source is ES segment
     382    rep
     383    db      6Fh         ; OUTSW
     384    ret
     385
     386ALIGN JUMP_ALIGN
     387DWordWrite:
     388    shr     cx, 1       ; WORD count to DWORD count
     389    eSEG    es          ; Source is ES segment
     390    rep
     391    db      66h         ; Override operand size to 32-bit
     392    db      6Fh         ; OUTSW/OUTSD
     393    ret
     394
    351395
    352396
     
    354398ALIGN WORD_ALIGN
    355399g_rgfnPioRead:
    356     dw      DualByteRead        ; DEVICE_8BIT_DUAL_PORT_XTIDE
    357     dw      NULL                ; DEVICE_XTIDE_WITH_REVERSED_A3_AND_A0
    358     dw      SingleByteRead      ; DEVICE_8BIT_SINGLE_PORT
    359     dw      WordRead            ; DEVICE_16BIT_ATA
    360     dw      DWordRead           ; DEVICE_32BIT_ATA
     400    dw      DualByteReadForXtide    ; DEVICE_8BIT_DUAL_PORT_XTIDE
     401%ifdef USE_186
     402    dw      WordReadForXTplusAndAT  ; DEVICE_XTIDE_WITH_REVERSED_A3_AND_A0
     403%else
     404    dw      WordReadForXTIDEmod
     405%endif
     406    dw      SingleByteRead          ; DEVICE_8BIT_SINGLE_PORT
     407    dw      WordReadForXTplusAndAT  ; DEVICE_16BIT_ATA
     408    dw      DWordRead               ; DEVICE_32BIT_ATA
     409
    361410g_rgfnPioWrite:
    362     dw      DualByteWrite       ; DEVICE_8BIT_DUAL_PORT_XTIDE
    363     dw      NULL                ; DEVICE_XTIDE_WITH_REVERSED_A3_AND_A0
    364     dw      SingleByteWrite     ; DEVICE_8BIT_SINGLE_PORT
    365     dw      WordWrite           ; DEVICE_16BIT_ATA
    366     dw      DWordWrite          ; DEVICE_32BIT_ATA
     411    dw      DualByteWriteForXtide   ; DEVICE_8BIT_DUAL_PORT_XTIDE
     412    dw      WordWriteForXTIDEmod    ; DEVICE_XTIDE_WITH_REVERSED_A3_AND_A0
     413    dw      SingleByteWrite         ; DEVICE_8BIT_SINGLE_PORT
     414    dw      WordWrite               ; DEVICE_16BIT_ATA
     415    dw      DWordWrite              ; DEVICE_32BIT_ATA
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm

    r150 r152  
    161161    xor     bx, bx
    162162    call    FindDPT_ForDriveNumber
    163     jnc     SHORT .DptNotFound
    164163    mov     bl, [di+DPT.bIdevarsOffset]
    165164    mov     bx, [cs:bx+IDEVARS.wPort]
    166 .DptNotFound:
    167165    xchg    bx, cx
    168166    ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19hLate.asm

    r90 r152  
    1616ALIGN JUMP_ALIGN
    1717Int19hLate_InitializeInt19h:
    18     mov     bx, INTV_BOOTSTRAP
     18    mov     bx, BIOS_BOOT_LOADER_INTERRUPT_19h
    1919    mov     si, HandlerForLateInitialization
    2020    jmp     Interrupts_InstallHandlerToVectorInBXFromCSSI
     
    3131HandlerForLateInitialization:
    3232    LOAD_BDA_SEGMENT_TO es, ax
    33     call    Initialize_ShouldSkip       ; Skip initialization?
     33    call    Initialize_ShouldSkip           ; Skip initialization?
    3434    jnz     SHORT .SkipInitialization
    35     call    Initialize_AndDetectDrives  ; Installs boot menu loader
    36     int     INTV_BOOTSTRAP
     35    call    Initialize_AndDetectDrives      ; Installs boot menu loader
     36    int     BIOS_BOOT_LOADER_INTERRUPT_19h
    3737.SkipInitialization:
    38     call    RamVars_Initialize          ; RAMVARS must be initialized even for simple boot loader
    39     int     INTV_BOOTSTRAP              ; Call default system boot loader
     38    call    RamVars_Initialize              ; RAMVARS must be initialized even for simple boot loader
     39    int     BIOS_BOOT_LOADER_INTERRUPT_19h  ; Call default system boot loader
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19hMenu.asm

    r143 r152  
    8585    SWITCH_BACK_TO_POST_STACK
    8686    call    ClearSegmentsForBoot
    87     int     INTV_BOOT_FAILURE       ; Never returns
     87    int     BIOS_BOOT_FAILURE_INTERRUPT_18h ; Never returns
    8888
    8989
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm

    r124 r152  
    1919;--------------------------------------------------------------------
    2020FloppyDrive_IsInt40hInstalled:
    21     cmp     WORD [es:INTV_FLOPPY_FUNC*4+2], 0C000h  ; Any ROM segment?
     21    cmp     WORD [es:BIOS_DISKETTE_INTERRUPT_40h*4+2], 0C000h   ; Any ROM segment?
    2222%ifdef USE_AT   ; No need to verify on XT systems.
    2323    jb      SHORT .Int40hHandlerIsNotInstalled
     
    4545
    4646    call    .LoadInt40hVerifyParameters
    47     int     INTV_DISK_FUNC
     47    int     BIOS_DISK_INTERRUPT_13h
    4848    jc      SHORT .Int40hIsInstalled    ; Maybe there are not any floppy drives at all
    4949    push    es
     
    5151
    5252    call    .LoadInt40hVerifyParameters
    53     int     INTV_FLOPPY_FUNC
     53    int     BIOS_DISKETTE_INTERRUPT_40h
    5454
    5555    pop     dx
     
    113113    mov     ah, 08h         ; Get Drive Parameters
    114114    xor     bx, bx          ; FLOPPY_TYPE_525_OR_35_DD when function not supported
    115     int     INTV_FLOPPY_FUNC
     115    int     BIOS_DISKETTE_INTERRUPT_40h
    116116    ret
    117117
     
    167167    mov     ah, 08h                 ; Get Drive Parameters
    168168    cwd                             ; Floppy Drive 00h
    169     int     INTV_FLOPPY_FUNC
     169    int     BIOS_DISKETTE_INTERRUPT_40h
    170170    mov     cl, dl                  ; Number of Floppy Drives to CL
    171171
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm

    r150 r152  
    8989.StoreDptPointersToIntVectors:
    9090    mov     dl, 80h
     91    call    RamVars_IsDriveHandledByThisBIOS
     92    jnc     SHORT .FindForDrive81h  ; Store nothing if not our drive
    9193    call    FindDPT_ForDriveNumber  ; DPT to DS:DI
    92     jnc     SHORT .FindForDrive81h  ; Store nothing if not our drive
    93     mov     [es:INTV_HD0DPT*4], di
    94     mov     [es:INTV_HD0DPT*4+2], ds
     94    mov     [es:HD0_DPT_POINTER_41h*4], di
     95    mov     [es:HD0_DPT_POINTER_41h*4+2], ds
    9596.FindForDrive81h:
    9697    inc     dx
     98    call    RamVars_IsDriveHandledByThisBIOS
     99    jnc     SHORT .ResetDetectedDrives
    97100    call    FindDPT_ForDriveNumber
    98     jnc     SHORT .ResetDetectedDrives
    99     mov     [es:INTV_HD1DPT*4], di
    100     mov     [es:INTV_HD1DPT*4+2], ds
     101    mov     [es:HD1_DPT_POINTER_46h*4], di
     102    mov     [es:HD1_DPT_POINTER_46h*4+2], ds
    101103    ; Fall to .ResetDetectedDrives
    102104
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm

    r150 r152  
    2929;--------------------------------------------------------------------
    3030.InitializeInt13hAnd40h:
    31     mov     ax, [es:INTV_DISK_FUNC*4]           ; Load old INT 13h offset
    32     mov     dx, [es:INTV_DISK_FUNC*4+2]         ; Load old INT 13h segment
     31    mov     ax, [es:BIOS_DISK_INTERRUPT_13h*4]  ; Load old INT 13h offset
     32    mov     dx, [es:BIOS_DISK_INTERRUPT_13h*4+2]; Load old INT 13h segment
    3333    mov     [RAMVARS.fpOldI13h], ax             ; Store old INT 13h offset
    3434    mov     [RAMVARS.fpOldI13h+2], dx           ; Store old INT 13h segment
    35     mov     bx, INTV_DISK_FUNC                  ; INT 13h interrupt vector offset
     35    mov     bx, BIOS_DISK_INTERRUPT_13h         ; INT 13h interrupt vector offset
    3636    mov     si, Int13h_DiskFunctionsHandler     ; Interrupt handler offset
    3737    call    Interrupts_InstallHandlerToVectorInBXFromCSSI
     
    4242    call    FloppyDrive_IsInt40hInstalled
    4343    jc      SHORT .InitializeInt19h
    44     mov     [es:INTV_FLOPPY_FUNC*4], ax     ; Store old INT 13h offset
    45     mov     [es:INTV_FLOPPY_FUNC*4+2], dx   ; Store old INT 13h segment
     44    mov     [es:BIOS_DISKETTE_INTERRUPT_40h*4], ax      ; Store old INT 13h offset
     45    mov     [es:BIOS_DISKETTE_INTERRUPT_40h*4+2], dx    ; Store old INT 13h segment
    4646    ; Fall to .InitializeInt19h
    4747
     
    5757;--------------------------------------------------------------------
    5858.InitializeInt19h:
    59     mov     bx, INTV_BOOTSTRAP
     59    mov     bx, BIOS_BOOT_LOADER_INTERRUPT_19h
    6060    mov     si, Int19hMenu_BootLoader
    6161    call    Interrupts_InstallHandlerToVectorInBXFromCSSI
     
    110110;--------------------------------------------------------------------
    111111.InstallHighIrqHandler:
    112     add     bx, BYTE INTV_IRQ8 - 8          ; Interrupt vector number
     112    add     bx, BYTE HARDWARE_IRQ_8_INTERRUPT_70h - 8   ; Interrupt vector number
    113113    mov     si, IdeIrq_InterruptServiceRoutineForIrqs8to15
    114114    jmp     SHORT Interrupts_InstallHandlerToVectorInBXFromCSSI
     
    125125;--------------------------------------------------------------------
    126126.InstallLowIrqHandler:
    127     add     bx, BYTE INTV_IRQ0              ; Interrupt vector number
     127    add     bx, BYTE HARDWARE_IRQ_0_INTERRUPT_08h       ; Interrupt vector number
    128128    mov     si, IdeIrq_InterruptServiceRoutineForIrqs2to7
    129129    ; Fall to Interrupts_InstallHandlerToVectorInBXFromCSSI
     
    177177.UnmaskHighIrqController:
    178178    sub     al, 8               ; Slave interrupt number
    179     mov     dx, PORT_8259SL_IMR ; Load Slave Mask Register address
     179    mov     dx, SLAVE_8259_IMR
    180180    call    .ClearBitFrom8259MaskRegister
    181181    mov     al, 2               ; Master IRQ 2 to allow slave IRQs
     
    192192;--------------------------------------------------------------------
    193193.UnmaskLowIrqController:
    194     mov     dx, PORT_8259MA_IMR ; Load Mask Register address
     194    mov     dx, MASTER_8259_IMR
    195195    ; Fall to .ClearBitFrom8259MaskRegister
    196196
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r150 r152  
    1515; Included .inc files
    1616%include "AssemblyLibrary.inc"  ; Assembly Library. Must be included first!
    17 %include "Interrupts.inc"       ; For interrupt equates
     17%include "IntController.inc"    ; For Interrupt Controller equates
    1818%include "ATA_ID.inc"           ; For ATA Drive Information structs
    1919%include "IdeRegisters.inc"     ; For ATA Registers, flags and commands
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm

    r150 r152  
    7171ALIGN JUMP_ALIGN
    7272FindDPT_ToDSDIForIdeMasterAtPortDX:
    73     mov     si, FindDPT_IterateToMasterAtPortCallback
     73    mov     si, IterateToMasterAtPortCallback
    7474    jmp     SHORT IterateAllDPTs
    7575
    7676ALIGN JUMP_ALIGN
    7777FindDPT_ToDSDIForIdeSlaveAtPortDX:
    78     mov     si, FindDPT_IterateToSlaveAtPortCallback
     78    mov     si, IterateToSlaveAtPortCallback
    7979    jmp     SHORT IterateAllDPTs
    8080
     
    8383; IDE base port for Master or Slave drive.
    8484;
    85 ; FindDPT_IterateToSlaveAtPortCallback
    86 ; FindDPT_IterateToMasterAtPortCallback
     85; IterateToSlaveAtPortCallback
     86; IterateToMasterAtPortCallback
    8787;   Parameters:
    8888;       CH:     Drive number
     
    9797;--------------------------------------------------------------------
    9898ALIGN JUMP_ALIGN
    99 FindDPT_IterateToSlaveAtPortCallback:
     99IterateToSlaveAtPortCallback:
    100100    test    BYTE [di+DPT.wFlags], FLG_DPT_SLAVE ; Clears CF
    101101    jnz     SHORT CompareBasePortAddress
     
    103103
    104104ALIGN JUMP_ALIGN
    105 FindDPT_IterateToMasterAtPortCallback:
     105IterateToMasterAtPortCallback:
    106106    test    BYTE [di+DPT.wFlags], FLG_DPT_SLAVE
    107107    jnz     SHORT ReturnWrongDPT                ; Return if slave drive
     
    116116    stc                                         ; Set CF since wanted DPT
    117117    ret
     118
     119
     120;--------------------------------------------------------------------
     121; FindDPT_ToDSDIforInterruptInService
     122;   Parameters:
     123;       DS:     RAMVARS segment
     124;   Returns:
     125;       DS:DI:  Ptr to DPT
     126;       CF:     Set if wanted DPT found
     127;               Cleared if DPT not found
     128;   Corrupts registers:
     129;       SI
     130;--------------------------------------------------------------------
     131ALIGN JUMP_ALIGN
     132FindDPT_ToDSDIforInterruptInService:
     133    mov     si, IterateToDptWithInterruptInServiceFlagSet
     134    jmp     SHORT IterateAllDPTs
     135
     136;--------------------------------------------------------------------
     137; IterateToDptWithInterruptInServiceFlagSet
     138;   Parameters:
     139;       DS:DI:  Ptr to DPT to examine
     140;   Returns:
     141;       CF:     Set if wanted DPT found
     142;               Cleared if wrong DPT
     143;   Corrupts registers:
     144;       Nothing
     145;--------------------------------------------------------------------
     146ALIGN JUMP_ALIGN
     147IterateToDptWithInterruptInServiceFlagSet:
     148    test    WORD [di+DPT.wFlags], FLG_DPT_INTERRUPT_IN_SERVICE
     149    jz      SHORT ReturnWrongDPT
     150    stc                                     ; Set CF since wanted DPT
     151    ret
    118152ReturnWrongDPT:
    119     clc                                         ; Clear CF since wrong DPT
     153    clc                                     ; Clear CF since wrong DPT
    120154    ret
    121155
     
    126160; IterateAllDPTs
    127161;   Parameters:
    128 ;       BX,DX:  Parameters to callback function
    129 ;       CS:SI:  Ptr to callback function
    130 ;       DS:     RAMVARS segment
     162;       AX,BX,DX:   Parameters to callback function
     163;       CS:SI:      Ptr to callback function
     164;       DS:         RAMVARS segment
    131165;   Returns:
    132 ;       DS:DI:  Ptr to wanted DPT (if found)
    133 ;       CF:     Set if wanted DPT found
    134 ;               Cleared if DPT not found
     166;       DS:DI:      Ptr to wanted DPT (if found)
     167;       CF:         Set if wanted DPT found
     168;                   Cleared if DPT not found
    135169;   Corrupts registers:
    136170;       Nothing unless corrupted by callback function
     
    141175    mov     cx, [RAMVARS.wDrvCntAndFirst]
    142176    jcxz    .AllDptsIterated            ; Return if no drives
    143     call    FindDPT_PointToFirstDPT     ; Point DS:DI to first DPT
     177    mov     di, RAMVARS_size            ; Point DS:DI to first DPT
    144178ALIGN JUMP_ALIGN
    145179.LoopWhileDPTsLeft:
     
    155189    pop     cx
    156190    ret
    157 
    158 
    159 ;--------------------------------------------------------------------
    160 ; Sets DI to point to first Disk Parameter Table.
    161 ;
    162 ; FindDPT_PointToFirstDPT
    163 ;   Parameters:
    164 ;       Nothing
    165 ;   Returns:
    166 ;       DI:     Offset to first DPT (even if unused)
    167 ;   Corrupts registers:
    168 ;       Nothing
    169 ;--------------------------------------------------------------------
    170 ALIGN JUMP_ALIGN
    171 FindDPT_PointToFirstDPT:
    172     mov     di, RAMVARS_size
    173     ret
Note: See TracChangeset for help on using the changeset viewer.