Changeset 33 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs


Ignore:
Timestamp:
Aug 23, 2010, 4:27:11 PM (14 years ago)
Author:
aitotat
google:author:
aitotat
Message:

Interrupt controllers are now unmasked during drive reset.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm

    r32 r33  
    22; Project name  :   IDE BIOS
    33; Created date  :   14.3.2010
    4 ; Last update   :   3.8.2010
     4; Last update   :   23.8.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for accessings RAMVARS.
     
    2323ALIGN JUMP_ALIGN
    2424RamVars_Initialize:
    25     call    RamVars_StealBaseMemory ; Get RAMVARS segment to DS even if no stealing
    26     call    RamVars_ClearToZero
     25    call    .StealMemoryForRAMVARS  ; Get RAMVARS segment to DS even if no stealing
     26    call    .ClearRamvarsFromDS
    2727    jmp     DriveXlate_Reset
    2828
    29 
    30 ;--------------------------------------------------------------------
    31 ; Steals base memory to be used for RAMVARS.
    32 ;
    33 ; RamVars_StealBaseMemory
     29;--------------------------------------------------------------------
     30; .StealMemoryForRAMVARS
    3431;   Parameters:
    3532;       Nothing
     
    4037;--------------------------------------------------------------------
    4138ALIGN JUMP_ALIGN
    42 RamVars_StealBaseMemory:
     39.StealMemoryForRAMVARS:
    4340    test    BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
    44     jz      SHORT RamVars_GetSegmentToDS    ; No need to steal
    45 
    46     LOAD_BDA_SEGMENT_TO ds, ax              ; Zero AX
     41    jz      SHORT RamVars_GetSegmentToDS
     42
     43    LOAD_BDA_SEGMENT_TO ds, ax      ; Zero AX
    4744    mov     al, [cs:ROMVARS.bStealSize]
    48     sub     [BDA.wBaseMem], ax              ; Steal one or more kilobytes
    49     mov     ax, [BDA.wBaseMem]              ; Load base memory left
    50     eSHL_IM ax, 6                           ; Shift for segment address
    51     mov     ds, ax                          ; Copy RAMVARS segment to DS
    52     ret
    53 
    54 
    55 ;--------------------------------------------------------------------
    56 ; Returns segment to RAMVARS.
    57 ; RAMVARS might be located at the top of interrupt vectors (0030:0000h)
    58 ; or at the top of system base RAM.
    59 ;
    60 ; RamVars_GetSegmentToDS
    61 ;   Parameters:
    62 ;       Nothing
    63 ;   Returns:
    64 ;       DS:     RAMVARS segment
    65 ;   Corrupts registers:
    66 ;       DI
    67 ;--------------------------------------------------------------------
    68 ALIGN JUMP_ALIGN
    69 RamVars_GetSegmentToDS:
    70     test    BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
    71     jnz     SHORT RamVars_GetStolenSegmentToDS
    72     mov     di, SEGMENT_RAMVARS_TOP_OF_INTERRUPT_VECTORS
    73     mov     ds, di
    74     ret
    75 
    76 ALIGN JUMP_ALIGN
    77 RamVars_GetStolenSegmentToDS:
    78     LOAD_BDA_SEGMENT_TO ds, di
    79     mov     di, [BDA.wBaseMem]      ; Load available base memory size in kB
    80     eSHL_IM di, 6                   ; Segment to first stolen kB
    81 ALIGN JUMP_ALIGN
    82 .LoopStolenKBs:
    83     mov     ds, di                  ; EBDA segment to DS
    84     add     di, BYTE 64             ; DI to next stolen kB
    85     cmp     WORD [FULLRAMVARS.wSign], W_SIGN_FULLRAMVARS
    86     jne     SHORT .LoopStolenKBs    ; Loop until sign found (always found eventually)
    87     ret
    88 
    89 
    90 ;--------------------------------------------------------------------
    91 ; Clears RAMVARS variables to zero.
    92 ; FULLRAMVARS sign will be saved if available.
    93 ;
    94 ; RamVars_ClearToZero
     45    sub     [BDA.wBaseMem], ax
     46    mov     ax, [BDA.wBaseMem]
     47    eSHL_IM ax, 6                   ; Segment to first stolen kB (*=40h)
     48    mov     ds, ax
     49    ret
     50
     51;--------------------------------------------------------------------
     52; .ClearRamvarsFromDS
    9553;   Parameters:
    9654;       DS:     RAMVARS segment
     
    10159;--------------------------------------------------------------------
    10260ALIGN JUMP_ALIGN
    103 RamVars_ClearToZero:
     61.ClearRamvarsFromDS:
    10462    call    FindDPT_PointToFirstDPT ; Get RAMVARS/FULLRAMVARS size to DI
    10563    mov     cx, di                  ; Copy byte count to CX
     
    11068    rep stosb
    11169    mov     WORD [FULLRAMVARS.wSign], W_SIGN_FULLRAMVARS
     70    ret
     71
     72
     73;--------------------------------------------------------------------
     74; Returns segment to RAMVARS.
     75; RAMVARS might be located at the top of interrupt vectors (0030:0000h)
     76; or at the top of system base RAM.
     77;
     78; RamVars_GetSegmentToDS
     79;   Parameters:
     80;       Nothing
     81;   Returns:
     82;       DS:     RAMVARS segment
     83;   Corrupts registers:
     84;       DI
     85;--------------------------------------------------------------------
     86ALIGN JUMP_ALIGN
     87RamVars_GetSegmentToDS:
     88    test    BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
     89    jnz     SHORT .GetStolenSegmentToDS
     90    mov     di, SEGMENT_RAMVARS_TOP_OF_INTERRUPT_VECTORS
     91    mov     ds, di
     92    ret
     93
     94ALIGN JUMP_ALIGN
     95.GetStolenSegmentToDS:
     96    LOAD_BDA_SEGMENT_TO ds, di
     97    mov     di, [BDA.wBaseMem]      ; Load available base memory size in kB
     98    eSHL_IM di, 6                   ; Segment to first stolen kB (*=40h)
     99ALIGN JUMP_ALIGN
     100.LoopStolenKBs:
     101    mov     ds, di                  ; EBDA segment to DS
     102    add     di, BYTE 64             ; DI to next stolen kB
     103    cmp     WORD [FULLRAMVARS.wSign], W_SIGN_FULLRAMVARS
     104    jne     SHORT .LoopStolenKBs    ; Loop until sign found (always found eventually)
    112105    ret
    113106
     
    234227    and     dl, 7Fh                     ; Clear HD bit for drive count
    235228    ret
     229
     230
     231;--------------------------------------------------------------------
     232; RamVars_GetIdeControllerCountToCX
     233;   Parameters:
     234;       Nothing
     235;   Returns:
     236;       CX:     Number of IDE controllers to handle
     237;   Corrupts registers:
     238;       Nothing
     239;--------------------------------------------------------------------   
     240ALIGN JUMP_ALIGN
     241RamVars_GetIdeControllerCountToCX:
     242    mov     cx, 1                   ; Assume lite mode (one controller)
     243    test    BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
     244    jz      SHORT .Return
     245    mov     cl, [cs:ROMVARS.bIdeCnt]
     246ALIGN JUMP_ALIGN, ret
     247.Return:
     248    ret
Note: See TracChangeset for help on using the changeset viewer.