Changeset 560 in xtideuniversalbios


Ignore:
Timestamp:
Jul 3, 2013, 6:56:05 PM (11 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Very late init handler is now in MODULE_VERY_LATE_INITIALIZATION
Location:
trunk/XTIDE_Universal_BIOS
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13hBiosInit.asm

    r559 r560  
    2222SECTION .text
    2323
    24 TEMPORARY_VECTOR_FOR_SYSTEM_INT13h      EQU     21h ; MS-DOS
     24TEMPORARY_VECTOR_FOR_SYSTEM_INT13h      EQU     20h ; MS-DOS so BIOSes most likely do not use this
    2525
    2626
     27;--------------------------------------------------------------------
     28; Int 13h software interrupt handler.
     29; This handler captures boot sector read from foreign drive when our
     30; INT 19h is not called. This way we can for XTIDE Universal BIOS
     31; initialization even without INT 19h being called.
     32;
     33; Int13hBiosInit_Handler
     34;   Parameters:
     35;       AH:     Bios function
     36;               READ_SECTORS_INTO_MEMORY will initialize XTIDE Universal BIOS
     37;--------------------------------------------------------------------
    2738Int13hBiosInit_Handler:
     39    ; Initialize XTIDE Universal BIOS only if Int13hBiosInit_Handler is still at
     40    ; vector 13h. Otherwise some other BIOS has hooked us and our very late
     41    ; initialization is not possible.
     42    push    ds
     43    push    ax
     44    LOAD_BDA_SEGMENT_TO ds, ax
     45    pop     ax
     46    cmp     WORD [BIOS_DISK_INTERRUPT_13h*4], Int13hBiosInit_Handler
     47    pop     ds
     48    jne     SHORT .VeryLateInitFailed   ; XTIDE Universal BIOS does not work
     49
    2850    ; Ignore all but read command (assumed to read boot sector)
    2951    cmp     ah, READ_SECTORS_INTO_MEMORY
    30     jne     SHORT .MainBiosStillInInitializationMode
     52    je      SHORT Int19h_BootLoaderHandler
    3153
    32     LOAD_BDA_SEGMENT_TO ds, ax
    33 
    34     ; Now install our handler and call 19h since non-standard motherboard BIOS did not
    35     ; do that or our INT 19h hander was replaced by other BIOS.
    36     mov     WORD [BIOS_BOOT_LOADER_INTERRUPT_19h*4], Int19h_BootLoaderHandler
    37     mov     [BIOS_BOOT_LOADER_INTERRUPT_19h*4+2], cs
    38     int     BIOS_BOOT_LOADER_INTERRUPT_19h  ; Does not return
    39 
    40     ; Main BIOS might reset floppy drives etc. so let's wait longer
    41     ; before installing our INT 19h handler.
    42 .MainBiosStillInInitializationMode:
     54    ; Call system INT 13h since not trying to read boot sector
    4355    int     TEMPORARY_VECTOR_FOR_SYSTEM_INT13h
    4456    retf    2
    4557
    46 
    47 ;--------------------------------------------------------------------
    48 ; Int13hBiosInit_RestoreSystemHandler
    49 ;   Parameters:
    50 ;       Nothing
    51 ;   Returns:
    52 ;       Nothing
    53 ;   Corrupts registers:
    54 ;       AX, DS, ES
    55 ;--------------------------------------------------------------------
    56 Int13hBiosInit_RestoreSystemHandler:
    57     LOAD_BDA_SEGMENT_TO ds, ax
    58 
    59     ; Is our very late init handler in place
    60     cmp     WORD [BIOS_DISK_INTERRUPT_13h*4], Int13hBiosInit_Handler
    61     jne     SHORT .SystemHandlerAlreadyInPlace
    62 
    63     les     ax, [TEMPORARY_VECTOR_FOR_SYSTEM_INT13h*4]
    64     mov     [BIOS_DISK_INTERRUPT_13h*4], ax
    65     mov     [BIOS_DISK_INTERRUPT_13h*4+2], es
    66 .SystemHandlerAlreadyInPlace:
    67     ret
     58.VeryLateInitFailed:
     59    mov     ah, RET_HD_INVALID
     60    stc
     61    retf    2
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm

    r556 r560  
    3131    sti                                         ; Enable interrupts
    3232    cld                                         ; String instructions to increment pointers
    33 %ifndef USE_AT
    34     call    Int13hBiosInit_RestoreSystemHandler ; Needed if initialization was started on INT 13h instead on 19h
    35 %endif
    3633    LOAD_BDA_SEGMENT_TO es, ax                  ; Load BDA segment (zero) to ES
     34%ifdef MODULE_VERY_LATE_INITIALIZATION
     35    lds     ax, [es:TEMPORARY_VECTOR_FOR_SYSTEM_INT13h*4]
     36    mov     [es:BIOS_DISK_INTERRUPT_13h*4], ax
     37    mov     [es:BIOS_DISK_INTERRUPT_13h*4+2], ds
     38%endif
    3739    ; Fall to .PrepareBootLoaderStack
    3840
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm

    r558 r560  
    3737    sti                                 ; Enable interrupts for keystrokes
    3838    push    ds
    39 
    40 %ifdef USE_AT
    41     push    BYTE 0
    42     pop     ds
    43 %else
    4439    push    ax                          ; We use AX to install very late init handler
    4540    LOAD_BDA_SEGMENT_TO ds, ax
    46 %endif
    4741
    4842    test    BYTE [BDA.bKBFlgs1], (1<<2) ; Clears ZF if CTRL is held down
     
    5347    mov     [BIOS_BOOT_LOADER_INTERRUPT_19h*4+2], cs
    5448
    55     ; Very late initialization for XT builds only
    56 %ifndef USE_AT
     49%ifdef MODULE_VERY_LATE_INITIALIZATION
    5750    push    es
    5851    ; Install special INT 13h hander that initializes XTIDE Universal BIOS
     
    6760
    6861.SkipRomInitialization:
    69 %ifndef USE_AT
    7062    pop     ax
    71 %endif
    7263    pop     ds
    7364    popf
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r559 r560  
    218218
    219219    ; Boot loader
     220%ifdef MODULE_VERY_LATE_INITIALIZATION
     221    %include "Int13hBiosInit.asm"
     222%endif
    220223    %include "Int19h.asm"           ; For Int 19h, Boot Loader
    221224    %include "BootSector.asm"       ; For loading boot sector
     
    254257
    255258    ; INT 13h Hard Disk BIOS functions
    256 %ifndef USE_AT
    257     %include "Int13hBiosInit.asm"
    258 %endif
    259259    %include "Int13h.asm"           ; For Int 13h, Disk functions
    260260    %include "AH0h_HReset.asm"
  • trunk/XTIDE_Universal_BIOS/makefile

    r558 r560  
    2727# MODULE_SERIAL_FLOPPY        Virtual floppy drives using serial port (requires MODULE_SERIAL)     #
    2828# MODULE_STRINGS_COMPRESSED   Use compressed strings to save space                                 #
     29# MODULE_VERY_LATE_INITIALIZATION Initialize on INT 13h if our INT 19h handler is not called       #
    2930# MODULE_FEATURE_SETS         Power Management support                                             #
    3031#                                                                                                  #
     
    100101# Assembler preprocessor defines.                               #
    101102#################################################################
    102 DEFINES_COMMON = MODULE_STRINGS_COMPRESSED MODULE_HOTKEYS MODULE_8BIT_IDE MODULE_EBIOS MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_FEATURE_SETS RESERVE_DIAGNOSTIC_CYLINDER
     103DEFINES_COMMON = MODULE_STRINGS_COMPRESSED MODULE_HOTKEYS MODULE_8BIT_IDE MODULE_EBIOS MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_VERY_LATE_INITIALIZATION MODULE_FEATURE_SETS RESERVE_DIAGNOSTIC_CYLINDER
    103104DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_8BIT_IDE_ADVANCED MODULE_COMPATIBLE_TABLES
    104105
Note: See TracChangeset for help on using the changeset viewer.