Ignore:
Timestamp:
Jan 25, 2011, 9:13:56 PM (13 years ago)
Author:
krille_n_@…
google:author:
krille_n_@hotmail.com
Message:

Size optimizations in various files in the XTIDE BIOS.
Also added a new include file for generic macros (macros.inc).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm

    r33 r86  
    1 ; File name     :   Interrupts.asm
    21; Project name  :   IDE BIOS
    3 ; Created date  :   23.8.2010
    4 ; Last update   :   23.8.2010
    5 ; Author        :   Tomi Tilli
    62; Description   :   Functions for initializing the BIOS.
    73
     
    1814;   Corrupts registers:
    1915;       All except segments
    20 ;--------------------------------------------------------------------   
     16;--------------------------------------------------------------------
    2117ALIGN JUMP_ALIGN
    2218Interrupts_InitializeInterruptVectors:
     
    2420    call    Interrupts_InitializeInt19h
    2521    jmp     SHORT Interrupts_InitializeHardwareIrqHandlers
     22    ; Maybe all this should be inlined?
    2623
    2724
     
    3532;   Corrupts registers:
    3633;       AX, BX, CX, DX, SI, DI
    37 ;--------------------------------------------------------------------   
     34;--------------------------------------------------------------------
    3835ALIGN JUMP_ALIGN
    3936Interrupts_InitializeInt13hAnd40h:
     
    5047    ; 40h from 13h. That system locks to infinite loop if we copy 13h to 40h.
    5148    call    FloppyDrive_IsInt40hInstalled
    52     jnc     SHORT .InitializeInt40h
    53     ret
    54 
    55 ;--------------------------------------------------------------------
    56 ; .InitializeInt40h
    57 ;   Parameters:
    58 ;       DX:AX:  Ptr to old INT 13h handler
    59 ;       ES:     BDA and Interrupt Vector segment (zero)
    60 ;   Returns:
    61 ;       Nothing
    62 ;   Corrupts registers:
    63 ;       Nothing
    64 ;--------------------------------------------------------------------   
    65 ALIGN JUMP_ALIGN
    66 .InitializeInt40h:
     49    jc      SHORT .Return
    6750    mov     [es:INTV_FLOPPY_FUNC*4], ax     ; Store offset
    6851    mov     [es:INTV_FLOPPY_FUNC*4+2], dx   ; Store segment
     52.Return:
    6953    ret
    7054
     
    7963;   Corrupts registers:
    8064;       BX, SI
    81 ;--------------------------------------------------------------------   
     65;--------------------------------------------------------------------
    8266ALIGN JUMP_ALIGN
    8367Interrupts_InitializeInt19h:
     
    116100;   Corrupts registers:
    117101;       BX, CX, DX, SI, DI
    118 ;--------------------------------------------------------------------       
     102;--------------------------------------------------------------------
    119103ALIGN JUMP_ALIGN
    120104Interrupts_InitializeHardwareIrqHandlers:
     
    127111    call    .InstallLowOrHighIrqHandler
    128112    loop    .IdeControllerLoop
    129     ret
     113.Return:
     114    ret     ; This ret is shared with .InstallLowOrHighIrqHandler
    130115
    131116;--------------------------------------------------------------------
     
    138123;   Corrupts registers:
    139124;       BX, SI
    140 ;--------------------------------------------------------------------       
     125;--------------------------------------------------------------------
    141126ALIGN JUMP_ALIGN
    142127.InstallLowOrHighIrqHandler:
     128    test    bl, bl
     129    jz      SHORT .Return   ; IRQ not used
    143130    cmp     bl, 8
    144     jae     SHORT .InstallHighIrqHandler
    145     test    bl, bl
    146     jnz     SHORT .InstallLowIrqHandler
    147     ret     ; IRQ not used
     131    jb      SHORT .InstallLowIrqHandler
     132    ; Fall through to .InstallHighIrqHandler
    148133
    149134;--------------------------------------------------------------------
     
    156141;   Corrupts registers:
    157142;       BX, SI
    158 ;--------------------------------------------------------------------       
    159 ALIGN JUMP_ALIGN
    160 .InstallHighIrqHandler:
     143;--------------------------------------------------------------------
     144;ALIGN JUMP_ALIGN
     145;.InstallHighIrqHandler:
    161146    add     bx, BYTE INTV_IRQ8 - 8          ; Interrupt vector number
    162147    mov     si, HIRQ_InterruptServiceRoutineForIrqs8to15
     
    172157;   Corrupts registers:
    173158;       BX, SI
    174 ;--------------------------------------------------------------------       
     159;--------------------------------------------------------------------
    175160ALIGN JUMP_ALIGN
    176161.InstallLowIrqHandler:
     
    190175;   Corrupts registers:
    191176;       BX
    192 ;--------------------------------------------------------------------   
     177;--------------------------------------------------------------------
    193178ALIGN JUMP_ALIGN
    194179Interrupts_InstallHandlerToVectorInBXFromCSSI:
     
    212197    eMOVZX  bx, BYTE [di+DPT.bIdeOff]
    213198    mov     al, [cs:bx+IDEVARS.bIRQ]
     199    test    al, al
     200    jz      SHORT .Return   ; Interrupts disabled
    214201    cmp     al, 8
    215     jae     SHORT .UnmaskHighIrqController
    216     test    al, al
    217     jnz     SHORT .UnmaskLowIrqController
    218     ret     ; Interrupts disabled
     202    jb      SHORT .UnmaskLowIrqController
     203    ; Fall through to .UnmaskHighIrqController
    219204
    220205;--------------------------------------------------------------------
     
    227212;       AX, DX
    228213;--------------------------------------------------------------------
    229 ALIGN JUMP_ALIGN
    230 .UnmaskHighIrqController:
     214;ALIGN JUMP_ALIGN
     215;.UnmaskHighIrqController:
    231216    sub     al, 8               ; Slave interrupt number
    232217    mov     dx, PORT_8259SL_IMR ; Load Slave Mask Register address
     
    270255    out     dx, al              ; Write modified Interrupt Mask Register
    271256    pop     cx
    272     ret
     257.Return:
     258    ret
Note: See TracChangeset for help on using the changeset viewer.