Changeset 33 in xtideuniversalbios


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

Interrupt controllers are now unmasked during drive reset.

Location:
trunk/XTIDE_Universal_BIOS/Src
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm

    r28 r33  
    22; Project name  :   IDE BIOS
    33; Created date  :   9.12.2007
    4 ; Last update   :   1.8.2010
     4; Last update   :   23.8.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Int 13h function AH=Dh, Reset Hard Disk (Alternate reset).
     
    5050
    5151    call    FindDPT_ForDriveNumber      ; DS:DI now points to DPT
     52    call    Interrupts_UnmaskInterruptControllerForDriveInDSDI
    5253    call    AHDh_ResetMasterAndSlave
    5354    ;jc     SHORT .ReturnError          ; CF would be set if slave drive present without master
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HError.asm

    r28 r33  
    22; Project name  :   IDE BIOS
    33; Created date  :   30.11.2007
    4 ; Last update   :   1.8.2010
     4; Last update   :   23.8.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Error checking functions for BIOS Hard disk functions.
     
    1313;   Parameters:
    1414;       DS:     RAMVARS segment
    15 ;       ES:     BDA segment (zero)
    1615;       CF:     Set if timeout
    1716;               Cleared if task flag was properly set
     
    2524ALIGN JUMP_ALIGN
    2625HError_ProcessErrorsAfterPollingTaskFlag:
    27     jc      SHORT HError_ProcessTimeoutAfterPollingBSYandSomeOtherStatusBit
    28     mov     ax, [es:HDBDA.wHDStAndErr]
    29     call    GetBiosErrorCodeToAHfromStatusAndErrorRegistersInAX
    30     mov     [es:BDA.bHDLastSt], ah
    31     mov     BYTE [es:BDA.bHDTaskFlg], 0
    32     ret
     26    jnc     SHORT HError_ProcessErrorsAfterPollingBSY
     27    ; Fall to HError_ProcessTimeoutAfterPollingBSYandSomeOtherStatusBit
    3328
    3429;--------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HIRQ.asm

    r28 r33  
    22; Project name  :   IDE BIOS
    33; Created date  :   11.12.2009
    4 ; Last update   :   1.8.2010
     4; Last update   :   23.8.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Interrupt handling related functions.
     
    3636ALIGN JUMP_ALIGN
    3737.TaskFlagPollingComplete:
    38     call    HError_ProcessErrorsAfterPollingTaskFlag
    3938    pop     es
    40     ret
     39    jmp     HError_ProcessErrorsAfterPollingTaskFlag
     40
    4141
    4242;--------------------------------------------------------------------
     
    187187
    188188    ; Reading Status Register acknowledges IDE interrupt
    189     call    RamVars_GetSegmentToDS
    190     call    HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA
     189    ;call   RamVars_GetSegmentToDS
     190    ;call   HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA
     191    LOAD_BDA_SEGMENT_TO ds, ax
    191192    mov     BYTE [BDA.bHDTaskFlg], 0FFh     ; Set task flag
    192193
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm

    r3 r33  
    22; Project name  :   IDE BIOS
    33; Created date  :   17.3.2010
    4 ; Last update   :   2.5.2010
     4; Last update   :   23.8.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for detecting drive for the BIOS.
     
    2424ALIGN JUMP_ALIGN
    2525DetectDrives_FromAllIDEControllers:
    26     call    Initialize_GetIdeControllerCountToCX
     26    call    RamVars_GetIdeControllerCountToCX
    2727    mov     bp, ROMVARS.ideVars0            ; CS:BP now points to first IDEVARS
    2828ALIGN JUMP_ALIGN
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm

    r28 r33  
    22; Project name  :   IDE BIOS
    33; Created date  :   23.3.2010
    4 ; Last update   :   1.8.2010
     4; Last update   :   23.8.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for initializing the BIOS.
     
    8282    mov     bl, INTV_BOOTSTRAP
    8383    mov     si, Int19h_LateInitialization
    84     ; Fall to Initialize_InstallInterruptHandler
    85 
    86 ;--------------------------------------------------------------------
    87 ; Installs any interrupt handler.
    88 ;
    89 ; Initialize_InstallInterruptHandler
    90 ;   Parameters:
    91 ;       BX:     Interrupt vector number (for example 13h)
    92 ;       ES:     BDA and Interrupt Vector segment (zero)
    93 ;       CS:SI:  Ptr to interrupt handler
    94 ;   Returns:
    95 ;       Nothing
    96 ;   Corrupts registers:
    97 ;       BX
    98 ;--------------------------------------------------------------------   
    99 ALIGN JUMP_ALIGN
    100 Initialize_InstallInterruptHandler:
    101     eSHL_IM bx, 2                   ; Shift for DWORD offset
    102     mov     [es:bx], si             ; Store offset
    103     mov     [es:bx+2], cs           ; Store segment
    104     ret
     84    jmp     Interrupts_InstallHandlerToVectorInBXFromCSSI
    10585
    10686
     
    122102    call    RamVars_GetSegmentToDS
    123103    LOAD_BDA_SEGMENT_TO es, ax
    124     call    Initialize_InterruptVectors
     104    call    Interrupts_InitializeInterruptVectors
    125105    call    DetectDrives_FromAllIDEControllers
    126106    call    CompatibleDPT_CreateForDrives80hAnd81h
    127     jmp     Initialize_ResetDetectedDrives
    128 
    129 
    130 ;--------------------------------------------------------------------
    131 ; Initializes Interrupt Vectors.
    132 ;
    133 ; Initialize_InterruptVectors
    134 ;   Parameters:
    135 ;       DS:     RAMVARS segment
    136 ;       ES:     BDA and Interrupt Vector segment (zero)
    137 ;   Returns:
    138 ;       Nothing
    139 ;   Corrupts registers:
    140 ;       All except segments
    141 ;--------------------------------------------------------------------   
    142 ALIGN JUMP_ALIGN
    143 Initialize_InterruptVectors:
    144     call    Initialize_Int13hAnd40h
    145     call    Initialize_Int19h
    146     jmp     SHORT Initialize_HardwareIrqHandlers
    147 
    148 
    149 ;--------------------------------------------------------------------
    150 ; Initializes INT 13h and 40h handlers for Hard Disk and
    151 ; Floppy Drive BIOS functions.
    152 ;
    153 ; Initialize_Int13hAnd40h
    154 ;   Parameters:
    155 ;       DS:     RAMVARS segment
    156 ;       ES:     BDA and Interrupt Vector segment (zero)
    157 ;   Returns:
    158 ;       Nothing
    159 ;   Corrupts registers:
    160 ;       AX, BX, CX, DX, SI, DI
    161 ;--------------------------------------------------------------------   
    162 ALIGN JUMP_ALIGN
    163 Initialize_Int13hAnd40h:
    164     mov     ax, [es:INTV_DISK_FUNC*4]           ; Load old INT 13h offset
    165     mov     dx, [es:INTV_DISK_FUNC*4+2]         ; Load old INT 13h segment
    166     mov     [RAMVARS.fpOldI13h], ax             ; Store old INT 13h offset
    167     mov     [RAMVARS.fpOldI13h+2], dx           ; Store old INT 13h segment
    168     mov     bx, INTV_DISK_FUNC                  ; INT 13h interrupt vector offset
    169     mov     si, Int13h_DiskFunctions            ; Interrupt handler offset
    170     call    Initialize_InstallInterruptHandler
    171 
    172     ; Only store INT 13h handler to 40h if 40h is not already installed.
    173     ; At least AMI BIOS for 286 stores 40h handler by itself and calls
    174     ; 40h from 13h. That system locks to infinite loop if we copy 13h to 40h.
    175     call    FloppyDrive_IsInt40hInstalled
    176     jnc     SHORT Initialize_Int40h
    177     ret
    178 
    179 ;--------------------------------------------------------------------
    180 ; Initializes INT 40h handler for Floppy Drive BIOS functions.
    181 ;
    182 ; Initialize_Int40h
    183 ;   Parameters:
    184 ;       DX:AX:  Ptr to old INT 13h handler
    185 ;       ES:     BDA and Interrupt Vector segment (zero)
    186 ;   Returns:
    187 ;       Nothing
    188 ;   Corrupts registers:
    189 ;       Nothing
    190 ;--------------------------------------------------------------------   
    191 ALIGN JUMP_ALIGN
    192 Initialize_Int40h:
    193     mov     [es:INTV_FLOPPY_FUNC*4], ax     ; Store offset
    194     mov     [es:INTV_FLOPPY_FUNC*4+2], dx   ; Store segment
    195     ret
    196 
    197 
    198 ;--------------------------------------------------------------------
    199 ; Initializes INT 19h handler for boot loader.
    200 ;
    201 ; Initialize_Int19h
    202 ;   Parameters:
    203 ;       DS:     RAMVARS segment
    204 ;       ES:     BDA and Interrupt Vector segment (zero)
    205 ;   Returns:
    206 ;       Nothing
    207 ;   Corrupts registers:
    208 ;       BX, SI
    209 ;--------------------------------------------------------------------   
    210 ALIGN JUMP_ALIGN
    211 Initialize_Int19h:
    212     eMOVZX  bx, [cs:ROMVARS.bBootLdrType]   ; Load boot loader type
    213     mov     si, INTV_BOOTSTRAP              ; 19h
    214     xchg    bx, si                          ; SI=Loader type, BX=19h
    215     jmp     [cs:si+.rgwSetupBootLoader]     ; Jump to install selected loader
    216 ALIGN WORD_ALIGN
    217 .rgwSetupBootLoader:
    218     dw      .SetupBootMenuLoader        ; BOOTLOADER_TYPE_MENU
    219     dw      .SetupSimpleLoader          ; BOOTLOADER_TYPE_SIMPLE
    220     dw      .SetupBootMenuLoader        ; reserved
    221     dw      .NoBootLoader               ; BOOTLOADER_TYPE_NONE
    222 
    223 ALIGN JUMP_ALIGN
    224 .NoBootLoader:
    225     test    BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_LATE
    226     jnz     SHORT .SetupSimpleLoader    ; Boot loader required for late initialization
    227     ret
    228 ALIGN JUMP_ALIGN
    229 .SetupSimpleLoader:
    230     mov     si, Int19h_SimpleBootLoader
    231     jmp     Initialize_InstallInterruptHandler
    232 ALIGN JUMP_ALIGN
    233 .SetupBootMenuLoader:
    234     mov     si, Int19hMenu_BootLoader
    235     jmp     Initialize_InstallInterruptHandler
    236 
    237 
    238 ;--------------------------------------------------------------------
    239 ; Initializes hardware IRQ handlers.
    240 ;
    241 ; Initialize_HardwareIrqHandlers
    242 ;   Parameters:
    243 ;       ES:     BDA and Interrupt Vector segment (zero)
    244 ;   Returns:
    245 ;       Nothing
    246 ;   Corrupts registers:
    247 ;       AX, BX, CX, DX, SI, DI
    248 ;--------------------------------------------------------------------       
    249 ALIGN JUMP_ALIGN
    250 Initialize_HardwareIrqHandlers:
    251     mov     di, ROMVARS.ideVars0            ; CS:SI points to first IDEVARS
    252     call    Initialize_GetIdeControllerCountToCX
    253 ALIGN JUMP_ALIGN
    254 .IdeControllerLoop:
    255     mov     al, [cs:di+IDEVARS.bIRQ]        ; Load IRQ number
    256     add     di, BYTE IDEVARS_size           ; Increment to next controller
    257     call    Initialize_LowOrHighIrqHandler
    258     loop    .IdeControllerLoop
    259     ret
    260 
    261 ;--------------------------------------------------------------------
    262 ; Returns number of IDE controllers handled by our BIOS.
    263 ;
    264 ; Initialize_GetIdeControllerCountToCX
    265 ;   Parameters:
    266 ;       Nothing
    267 ;   Returns:
    268 ;       CX:     Number of IDE controllers to handle
    269 ;   Corrupts registers:
    270 ;       Nothing
    271 ;--------------------------------------------------------------------   
    272 ALIGN JUMP_ALIGN
    273 Initialize_GetIdeControllerCountToCX:
    274     mov     cx, 1                   ; Assume lite mode (one controller)
    275     test    BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
    276     jz      SHORT .Return
    277     mov     cl, [cs:ROMVARS.bIdeCnt]
    278 ALIGN JUMP_ALIGN
    279 .Return:
    280     ret
    281 
    282 ;--------------------------------------------------------------------
    283 ; Initializes hardware IRQ handler for specific IRQ.
    284 ;
    285 ; Initialize_LowOrHighIrqHandler
    286 ;   Parameters:
    287 ;       AL:     IRQ number, 0 if IRQ disabled
    288 ;       ES:     BDA and Interrupt Vector segment (zero)
    289 ;   Returns:
    290 ;       Nothing
    291 ;   Corrupts registers:
    292 ;       AX, BX, DX, SI
    293 ;--------------------------------------------------------------------       
    294 ALIGN JUMP_ALIGN
    295 Initialize_LowOrHighIrqHandler:
    296     test    al, al                          ; IRQ disabled?
    297     jz      SHORT .Return                   ;  If so, return
    298     eMOVZX  bx, al                          ; Copy IRQ number to BX
    299     cmp     al, 8                           ; High IRQ? (AT systems only)
    300     jae     SHORT Initialize_HighIrqHandler
    301     jmp     SHORT Initialize_LowIrqHandler
    302 ALIGN JUMP_ALIGN
    303 .Return:
    304     ret
    305 
    306 
    307 ;--------------------------------------------------------------------
    308 ; Initializes handler for high IRQ (8...15).
    309 ;
    310 ; Initialize_HighIrqHandler
    311 ;   Parameters:
    312 ;       AL,BX:  IRQ number (8...15)
    313 ;       ES:     BDA and Interrupt Vector segment (zero)
    314 ;   Returns:
    315 ;       Nothing
    316 ;   Corrupts registers:
    317 ;       AX, BX, DX, SI
    318 ;--------------------------------------------------------------------       
    319 ALIGN JUMP_ALIGN
    320 Initialize_HighIrqHandler:
    321     add     bx, BYTE INTV_IRQ8 - 8          ; Interrupt vector number
    322     mov     si, HIRQ_InterruptServiceRoutineForIrqs8to15
    323     call    Initialize_InstallInterruptHandler
    324     ; Fall to Initialize_UnmaskHighIrqController
    325 
    326 ;--------------------------------------------------------------------
    327 ; Unmasks interrupt from Slave 8259 interrupt controller (IRQs 8...15)
    328 ;
    329 ; Initialize_HighIrqHandler
    330 ;   Parameters:
    331 ;       AL:     IRQ number (8...15)
    332 ;   Returns:
    333 ;       Nothing
    334 ;   Corrupts registers:
    335 ;       AX, DX
    336 ;--------------------------------------------------------------------
    337 ALIGN JUMP_ALIGN
    338 Initialize_UnmaskHighIrqController:
    339     sub     al, 8               ; Slave interrupt number
    340     mov     dx, PORT_8259SL_IMR ; Load Slave Mask Register address
    341     call    Initialize_ClearBitFrom8259MaskRegister
    342     mov     al, 2               ; Master IRQ 2 to allow slave IRQs
    343     jmp     SHORT Initialize_UnmaskLowIrqController
    344 
    345 
    346 ;--------------------------------------------------------------------
    347 ; Initializes handler for low IRQ (0...7).
    348 ;
    349 ; Initialize_LowIrqHandler
    350 ;   Parameters:
    351 ;       AL,BX:  IRQ number (0...7)
    352 ;       ES:     BDA and Interrupt Vector segment (zero)
    353 ;   Returns:
    354 ;       Nothing
    355 ;   Corrupts registers:
    356 ;       AX, BX, DX, SI
    357 ;--------------------------------------------------------------------       
    358 ALIGN JUMP_ALIGN
    359 Initialize_LowIrqHandler:
    360     add     bx, BYTE INTV_IRQ0              ; Interrupt vector number
    361     mov     si, HIRQ_InterruptServiceRoutineForIrqs2to7
    362     call    Initialize_InstallInterruptHandler
    363     ; Fall to Initialize_UnmaskLowIrqController
    364 
    365 ;--------------------------------------------------------------------
    366 ; Unmasks interrupt from Master 8259 interrupt controller (IRQs 0...7)
    367 ;
    368 ; Initialize_UnmaskLowIrqController
    369 ;   Parameters:
    370 ;       AL:     IRQ number (0...7)
    371 ;   Returns:
    372 ;       Nothing
    373 ;   Corrupts registers:
    374 ;       AX, DX
    375 ;--------------------------------------------------------------------
    376 ALIGN JUMP_ALIGN
    377 Initialize_UnmaskLowIrqController:
    378     mov     dx, PORT_8259MA_IMR ; Load Mask Register address
    379     ; Fall to Initialize_ClearBitFrom8259MaskRegister
    380 
    381 ;--------------------------------------------------------------------
    382 ; Unmasks interrupt from Master or Slave 8259 Interrupt Controller.
    383 ;
    384 ; Initialize_ClearBitFrom8259MaskRegister
    385 ;   Parameters:
    386 ;       AL:     8259 interrupt index (0...7)
    387 ;       DX:     Port address to Interrupt Mask Register
    388 ;   Returns:
    389 ;       Nothing
    390 ;   Corrupts registers:
    391 ;       AX
    392 ;--------------------------------------------------------------------
    393 ALIGN JUMP_ALIGN
    394 Initialize_ClearBitFrom8259MaskRegister:
    395     push    cx
    396     xchg    ax, cx              ; IRQ index to CL
    397     mov     ch, 1               ; Load 1 to be shifted
    398     shl     ch, cl              ; Shift bit to correct position
    399     not     ch                  ; Invert to create bit mask for clearing
    400     in      al, dx              ; Read Interrupt Mask Register
    401     and     al, ch              ; Clear wanted bit
    402     out     dx, al              ; Write modified Interrupt Mask Register
    403     pop     cx
    404     ret
    405 
     107    ; Fall to .ResetDetectedDrives
    406108
    407109;--------------------------------------------------------------------
     
    416118;       AX, BX, CX, DX, DI
    417119;--------------------------------------------------------------------
    418 ALIGN JUMP_ALIGN
    419 Initialize_ResetDetectedDrives:
     120;ALIGN JUMP_ALIGN
     121.ResetDetectedDrives:
    420122    jmp     AH0h_ResetHardDisksHandledByOurBIOS
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r32 r33  
    3838    at  ROMVARS.bRomSize,   db  CNT_ROM_BLOCKS  ; ROM size in 512B blocks
    3939    at  ROMVARS.rgbJump,    jmp Initialize_FromMainBiosRomSearch
    40     at  ROMVARS.rgbDate,    db  "08/03/10"      ; Build data (mm/dd/yy)
     40    at  ROMVARS.rgbDate,    db  "08/23/10"      ; Build data (mm/dd/yy)
    4141    at  ROMVARS.rgbSign,    db  "XTIDE110"      ; Signature for flash program
    4242    at  ROMVARS.szTitle
     
    4949        db  " (XT)=-",STOP
    5050%endif
    51     at  ROMVARS.szVersion,  db  "v1.1.3 (08/03/10)",STOP
     51    at  ROMVARS.szVersion,  db  "v1.1.3 (08/23/10)",STOP
    5252
    5353;---------------------------;
     
    119119; Include .asm files (Initialization and drive detection)
    120120%include "Initialize.asm"       ; For BIOS initialization
     121%include "Interrupts.asm"       ; For Interrupt initialization
    121122%include "RamVars.asm"          ; For RAMVARS initialization and access
    122123%include "CreateDPT.asm"        ; For creating DPTs
  • 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.