source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm @ 258

Last change on this file since 258 was 258, checked in by gregli@…, 12 years ago

Added floppy drive emulation over the serial connection (MODULE_SERIAL_FLOPPY). Along the way, various optimizations were made to stay within the 8K ROM size target. Also, serial code now returns the number of sectors transferred.

File size: 2.9 KB
RevLine 
[90]1; Project name  :   XTIDE Universal BIOS
[3]2; Description   :   Functions for initializing the BIOS.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
8; Initializes the BIOS.
9; This function is called from main BIOS ROM search routine.
10;
11; Initialize_FromMainBiosRomSearch
12;   Parameters:
13;       Nothing
14;   Returns:
15;       Nothing
16;   Corrupts registers:
17;       Nothing
18;--------------------------------------------------------------------
[229]19Initialize_FromMainBiosRomSearch:           ; unused entrypoint ok
[3]20    pushf
21    push    es
22    push    ds
23    ePUSHA
24
[90]25    LOAD_BDA_SEGMENT_TO es, ax
[229]26    sti                                     ; Enable interrupts
27    test    BYTE [es:BDA.bKBFlgs1], (1<<2)  ; Clears ZF if CTRL is held down
[90]28    jnz     SHORT .SkipRomInitialization
[3]29
[229]30    ; Install INT 19h handler (boot loader) where drives are detected
[258]31    mov     al, BIOS_BOOT_LOADER_INTERRUPT_19h
[243]32    mov     si, Int19h_BootLoaderHandler
[258]33    call    Interrupts_InstallHandlerToVectorInALFromCSSI
[229]34
[90]35.SkipRomInitialization:
[3]36    ePOPA
37    pop     ds
38    pop     es
39    popf
40    retf
41
42
43;--------------------------------------------------------------------
44; Initializes the BIOS variables and detects IDE drives.
45;
46; Initialize_AndDetectDrives
47;   Parameters:
[90]48;       ES:     BDA Segment
[3]49;   Returns:
[97]50;       DS:     RAMVARS segment
[3]51;   Corrupts registers:
[97]52;       All
[3]53;--------------------------------------------------------------------
54Initialize_AndDetectDrives:
[130]55    call    BootMenuPrint_InitializeDisplayContext
[3]56    call    DetectPrint_RomFoundAtSegment
57    call    RamVars_Initialize
[33]58    call    Interrupts_InitializeInterruptVectors
[3]59    call    DetectDrives_FromAllIDEControllers
[98]60    ; Fall to .StoreDptPointersToIntVectors
[97]61
62;--------------------------------------------------------------------
[98]63; .StoreDptPointersToIntVectors
[97]64;   Parameters:
65;       DS:     RAMVARS segment
66;       ES:     BDA and interrupt vector segment (zero)
67;   Returns:
68;       Nothing
69;   Corrupts registers:
70;       DX, DI
71;--------------------------------------------------------------------
[98]72.StoreDptPointersToIntVectors:
[97]73    mov     dl, 80h
[152]74    call    RamVars_IsDriveHandledByThisBIOS
[258]75    jc      SHORT .FindForDrive81h  ; Store nothing if not our drive
[97]76    call    FindDPT_ForDriveNumber  ; DPT to DS:DI
[152]77    mov     [es:HD0_DPT_POINTER_41h*4], di
78    mov     [es:HD0_DPT_POINTER_41h*4+2], ds
[97]79.FindForDrive81h:
80    inc     dx
[152]81    call    RamVars_IsDriveHandledByThisBIOS
[258]82    jc      SHORT .ResetDetectedDrives
[97]83    call    FindDPT_ForDriveNumber
[152]84    mov     [es:HD1_DPT_POINTER_46h*4], di
85    mov     [es:HD1_DPT_POINTER_46h*4+2], ds
[33]86    ; Fall to .ResetDetectedDrives
[3]87
88;--------------------------------------------------------------------
[97]89; .ResetDetectedDrives
[3]90;   Parameters:
91;       DS:     RAMVARS segment
[243]92;       ES:     BDA and interrupt vector segment (zero)
[3]93;   Returns:
94;       Nothing
95;   Corrupts registers:
[243]96;       All, except DS and ES
[3]97;--------------------------------------------------------------------
[33]98.ResetDetectedDrives:
[150]99    call    Idepack_FakeToSSBP
100    call    AH0h_ResetHardDisksHandledByOurBIOS
[158]101    add     sp, BYTE EXTRA_BYTES_FOR_INTPACK
[150]102    ret
Note: See TracBrowser for help on using the repository browser.