source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuInfo.asm @ 363

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

Changes to XTIDE Universal BIOS:

  • Added Advanced ATA Module (MODULE_ADVANCED_ATA) with native support for QDI Vision QD6500 and QD6580 VLB IDE Controllers.
  • Hopefully optimized IDE transfer functions for 8088 (replaced some memory accesses from WORD to BYTE).
  • XT build does not fit in 8k at the moment!!!
File size: 3.7 KB
RevLine 
[88]1; Project name  :   XTIDE Universal BIOS
[3]2; Description   :   Functions for generating and accessing drive
3;                   information to be displayed on boot menu.
4
5; Section containing code
6SECTION .text
7
8;--------------------------------------------------------------------
[254]9; Creates new BOOTMENUINFO struct for detected hard disk.
[3]10;
[254]11; BootMenuInfo_CreateForHardDisk
[3]12;   Parameters:
13;       DL:     Drive number
14;       DS:DI:  Ptr to Disk Parameter Table
15;       ES:SI:  Ptr to 512-byte ATA information read from the drive
16;   Returns:
[254]17;       ES:BX:  Ptr to BOOTMENUINFO (if successful)
[3]18;   Corrupts registers:
[363]19;       AX, CX, DX, DI
[3]20;--------------------------------------------------------------------
[254]21BootMenuInfo_CreateForHardDisk:
22    call    BootMenuInfo_ConvertDPTtoBX         ; ES:BX now points to new BOOTMENUINFO
[363]23    push    ds                                  ; Preserve RAMVARS...
24    push    si                                  ; ...and SI
[3]25
[363]26    push    es                                  ; ES to be copied to DS
[3]27
[363]28%ifdef MODULE_ADVANCED_ATA
29    ; Copy DPT_ADVANCED_ATA to BOOTMENUINFO to keep DPTs small.
30    ; DPT_ADVANCED_ATA has variables that are only needed during initialization.
31    mov     ax, [di+DPT_ADVANCED_ATA.wIdeBasePort]
32    mov     [es:bx+BOOTMENUINFO.wIdeBasePort], ax
33    mov     dx, [di+DPT_ADVANCED_ATA.wMinPioActiveTimeNs]
34    mov     [es:bx+BOOTMENUINFO.wMinPioActiveTimeNs], dx
[241]35
[363]36    mov     ax, [di+DPT_ADVANCED_ATA.wMinPioRecoveryTimeNs]
37    mov     cx, [di+DPT_ADVANCED_ATA.wControllerID]
38    mov     dx, [di+DPT_ADVANCED_ATA.wControllerBasePort]
39    pop     ds                                  ; ES copied to DS
40    mov     [bx+BOOTMENUINFO.wMinPioRecoveryTimeNs], ax
41    mov     [bx+BOOTMENUINFO.wControllerID], cx
42    mov     [bx+BOOTMENUINFO.wControllerBasePort], dx
43
44%else
45    pop     ds                                  ; ES copied to DS
46%endif
47
48    ; Store Drive Name
[254]49    add     si, BYTE ATA1.strModel              ; DS:SI now points drive name
50    lea     di, [bx+BOOTMENUINFO.szDrvName]     ; ES:DI now points to name destination
51    mov     cx, MAX_HARD_DISK_NAME_LENGTH / 2   ; Max number of WORDs allowed
[121]52.CopyNextWord:
53    lodsw
[254]54    xchg    al, ah                              ; Change endianness
[121]55    stosw
56    loop    .CopyNextWord
[254]57    xor     ax, ax                              ; Zero AX and clear CF
58    stosw                                       ; Terminate with NULL
[3]59
60    pop     si
61    pop     ds
62    ret
63
[252]64
[3]65;--------------------------------------------------------------------
[254]66; BootMenuInfo_GetTotalSectorCount
[3]67;   Parameters:
[241]68;       DS:DI:      DPT Pointer
[3]69;   Returns:
70;       BX:DX:AX:   48-bit sector count
71;   Corrupts registers:
[252]72;       CX
[128]73;--------------------------------------------------------------------
[254]74BootMenuInfo_GetTotalSectorCount:
[252]75    test    BYTE [di+DPT.bFlagsLow], FLG_DRVNHEAD_LBA
76    jnz     SHORT .ReturnFullCapacity
77    jmp     AH15h_GetSectorCountToBXDXAX
78.ReturnFullCapacity:
79    jmp     AccessDPT_GetLbaSectorCountToBXDXAX
[100]80
81
82;--------------------------------------------------------------------
[363]83; BootMenuInfo_IsAvailable
84;   Parameters:
85;       Nothing
86;   Returns:
87;       ES:     Segment to BOOTVARS with BOOTMENUINFOs
88;       ZF:     Set if BOOTVARS with BOOTMENUINFOs is available
89;               Cleared if not available (no longer initializing)
90;   Corrupts registers:
91;       BX
92;--------------------------------------------------------------------
93BootMenuInfo_IsAvailable:
94    LOAD_BDA_SEGMENT_TO es, bx
95    cmp     WORD [es:BOOTVARS.wMagicWord], BOOTVARS_MAGIC_WORD
96    ret
97
98
99;--------------------------------------------------------------------
[254]100; Returns offset to BOOTMENUINFO based on DPT pointer.
[100]101;
[254]102; BootMenuInfo_ConvertDPTtoBX
[100]103;   Parameters:
[241]104;       DS:DI:  DPT Pointer
[100]105;   Returns:
[254]106;       BX:     Offset to BOOTMENUINFO struct
[100]107;   Corrupts registers:
[363]108;       Nothing
[100]109;--------------------------------------------------------------------
[254]110BootMenuInfo_ConvertDPTtoBX:
[363]111    push    ax
[241]112    mov     ax, di
[363]113    sub     ax, BYTE RAMVARS_size                   ; subtract off base of DPTs
[254]114    mov     bl, DPT_BOOTMENUINFO_SIZE_MULTIPLIER    ; BOOTMENUINFO's are a whole number multiple of DPT size
[241]115    mul     bl                             
[254]116    add     ax, BOOTVARS.rgBootNfo                  ; add base of BOOTMENUINFO
[241]117    xchg    ax, bx
[363]118    pop     ax
[241]119    ret         
Note: See TracBrowser for help on using the repository browser.