Changeset 150 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm


Ignore:
Timestamp:
Apr 29, 2011, 7:04:13 PM (13 years ago)
Author:
aitotat
google:author:
aitotat
Message:

Changes to XTIDE Universal BIOS:

  • Redesigned Disk Parameter Tables.
  • Code generalizations for supporting non-IDE devices in the future.
File:
1 edited

Legend:

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

    r148 r150  
    2222Int13h_DiskFunctionsHandler:
    2323    sti                                 ; Enable interrupts
    24     SAVE_AND_GET_INTPACK_TO_SSBP
     24    cld                                 ; String instructions to increment pointers
     25    SAVE_AND_GET_INTPACK_WITH_EXTRA_WORDS_TO_SSBP EXTRA_WORDS_TO_RESERVE_FOR_INTPACK
    2526
    2627    call    RamVars_GetSegmentToDS
     
    4647;       DL:     Translated drive number
    4748;       DS:     RAMVARS segment
    48 ;       SS:BP:  Ptr to INTPACK
     49;       SS:BP:  Ptr to IDEPACK
    4950;       BX, DI: Corrupted on Int13h_DiskFunctionsHandler
    5051;       Other:  Function specific INT 13h parameters
     
    5859Int13h_DirectCallToAnotherBios:
    5960    call    ExchangeCurrentInt13hHandlerWithOldInt13hHandler
    60     mov     bx, [bp+INTPACK.bx]
    61     mov     di, [bp+INTPACK.di]
    62     mov     ds, [bp+INTPACK.ds]
    63     push    WORD [bp+INTPACK.flags]
     61    mov     bx, [bp+IDEPACK.intpack+INTPACK.bx]
     62    mov     di, [bp+IDEPACK.intpack+INTPACK.di]
     63    mov     ds, [bp+IDEPACK.intpack+INTPACK.ds]
     64    push    WORD [bp+IDEPACK.intpack+INTPACK.flags]
    6465    popf
    6566    push    bp
    66     mov     bp, [bp+INTPACK.bp]
     67    mov     bp, [bp+IDEPACK.intpack+INTPACK.bp]
    6768    int     BIOS_DISK_INTERRUPT_13h ; Can safely do as much recursion as it wants
    6869
     
    7071    pop     bp  ; Standard INT 13h functions never uses BP as return register
    7172%ifdef USE_386
    72     mov     [bp+INTPACK.gs], gs
    73     mov     [bp+INTPACK.fs], fs
     73    mov     [bp+IDEPACK.intpack+INTPACK.gs], gs
     74    mov     [bp+IDEPACK.intpack+INTPACK.fs], fs
    7475%endif
    75     mov     [bp+INTPACK.es], es
    76     mov     [bp+INTPACK.ds], ds
    77     mov     [bp+INTPACK.di], di
    78     mov     [bp+INTPACK.si], si
    79     mov     [bp+INTPACK.bx], bx
    80     mov     [bp+INTPACK.dh], dh
    81     mov     [bp+INTPACK.cx], cx
    82     mov     [bp+INTPACK.ax], ax
     76    mov     [bp+IDEPACK.intpack+INTPACK.es], es
     77    mov     [bp+IDEPACK.intpack+INTPACK.ds], ds
     78    mov     [bp+IDEPACK.intpack+INTPACK.di], di
     79    mov     [bp+IDEPACK.intpack+INTPACK.si], si
     80    mov     [bp+IDEPACK.intpack+INTPACK.bx], bx
     81    mov     [bp+IDEPACK.intpack+INTPACK.dh], dh
     82    mov     [bp+IDEPACK.intpack+INTPACK.cx], cx
     83    mov     [bp+IDEPACK.intpack+INTPACK.ax], ax
    8384    pushf
    84     pop     WORD [bp+INTPACK.flags]
     85    pop     WORD [bp+IDEPACK.intpack+INTPACK.flags]
    8586    call    RamVars_GetSegmentToDS
    8687    cmp     dl, [RAMVARS.xlateVars+XLATEVARS.bXlatedDrv]
    8788    je      SHORT .ExchangeInt13hHandlers
    88     mov     [bp+INTPACK.dl], dl     ; Something is returned in DL
     89    mov     [bp+IDEPACK.intpack+INTPACK.dl], dl     ; Something is returned in DL
    8990ALIGN JUMP_ALIGN
    9091.ExchangeInt13hHandlers:
     
    9899;   Parameters:
    99100;       AH:     BIOS Error code
    100 ;       SS:BP:  Ptr to INTPACK
     101;       SS:BP:  Ptr to IDEPACK
    101102;   Returns:
    102103;       All registers are loaded from INTPACK
     
    104105ALIGN JUMP_ALIGN
    105106Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH:
    106     call    HError_SetErrorCodeToBdaAndToIntpackInSSBPfromAH
     107    call    Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH
    107108Int13h_ReturnFromHandlerWithoutStoringErrorCode:
    108     or      WORD [bp+INTPACK.flags], FLG_FLAGS_IF   ; Return with interrupts enabled
     109    or      WORD [bp+IDEPACK.intpack+INTPACK.flags], FLG_FLAGS_IF   ; Return with interrupts enabled
    109110    mov     sp, bp                                  ; Now we can exit anytime
    110     RESTORE_INTPACK_FROM_SSBP
     111    RESTORE_INTPACK_WITH_EXTRA_WORDS_FROM_SSBP EXTRA_WORDS_TO_RESERVE_FOR_INTPACK
    111112
    112113
     
    146147    LOAD_BDA_SEGMENT_TO es, di
    147148    mov     di, [RAMVARS.fpOldI13h]
     149    cli
    148150    xchg    di, [es:BIOS_DISK_INTERRUPT_13h*4]
    149151    mov     [RAMVARS.fpOldI13h], di
     
    152154    mov     [RAMVARS.fpOldI13h+2], di
    153155    pop     es
     156    sti
     157    ret
     158
     159
     160;--------------------------------------------------------------------
     161; Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH
     162; Int13h_SetErrorCodeToIntpackInSSBPfromAH
     163;   Parameters:
     164;       AH:     BIOS error code (00h = no error)
     165;       SS:BP:  Ptr to IDEPACK
     166;   Returns:
     167;       SS:BP:  Ptr to IDEPACK with error condition set
     168;   Corrupts registers:
     169;       DS, DI
     170;--------------------------------------------------------------------
     171ALIGN JUMP_ALIGN
     172Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH:
     173    ; Store error code to BDA
     174    LOAD_BDA_SEGMENT_TO ds, di
     175    mov     [BDA.bHDLastSt], ah
     176
     177    ; Store error code to INTPACK
     178Int13h_SetErrorCodeToIntpackInSSBPfromAH:
     179    mov     [bp+IDEPACK.intpack+INTPACK.ah], ah
     180    test    ah, ah
     181    jnz     SHORT .SetCFtoIntpack
     182    and     BYTE [bp+IDEPACK.intpack+INTPACK.flags], ~FLG_FLAGS_CF
     183    ret
     184.SetCFtoIntpack:
     185    or      BYTE [bp+IDEPACK.intpack+INTPACK.flags], FLG_FLAGS_CF
    154186    ret
    155187
     
    224256;   dw  Int13h_UnsupportedFunction                      ; 3Fh,
    225257;   dw  Int13h_UnsupportedFunction                      ; 40h,
    226 ;   dw  Int13h_UnsupportedFunction                      ; 41h, Check if Extensions Present (EBIOS)
    227 ;   dw  Int13h_UnsupportedFunction                      ; 42h, Extended Read Sectors (EBIOS)
    228 ;   dw  Int13h_UnsupportedFunction                      ; 43h, Extended Write Sectors (EBIOS)
    229 ;   dw  Int13h_UnsupportedFunction                      ; 44h, Extended Verify Sectors (EBIOS)
    230 ;   dw  Int13h_UnsupportedFunction                      ; 45h, Lock and Unlock Drive (EBIOS)
    231 ;   dw  Int13h_UnsupportedFunction                      ; 46h, Eject Media Request (EBIOS)
    232 ;   dw  Int13h_UnsupportedFunction                      ; 47h, Extended Seek (EBIOS)
    233 ;   dw  Int13h_UnsupportedFunction                      ; 48h, Get Extended Drive Parameters (EBIOS)
    234 ;   dw  Int13h_UnsupportedFunction                      ; 49h, Get Extended Disk Change Status (EBIOS)
     258;   dw  Int13h_UnsupportedFunction                      ; 41h, Check if Extensions Present (EBIOS)*
     259;   dw  Int13h_UnsupportedFunction                      ; 42h, Extended Read Sectors (EBIOS)*
     260;   dw  Int13h_UnsupportedFunction                      ; 43h, Extended Write Sectors (EBIOS)*
     261;   dw  Int13h_UnsupportedFunction                      ; 44h, Extended Verify Sectors (EBIOS)*
     262;   dw  Int13h_UnsupportedFunction                      ; 45h, Lock and Unlock Drive (EBIOS)***
     263;   dw  Int13h_UnsupportedFunction                      ; 46h, Eject Media Request (EBIOS)***
     264;   dw  Int13h_UnsupportedFunction                      ; 47h, Extended Seek (EBIOS)*
     265;   dw  Int13h_UnsupportedFunction                      ; 48h, Get Extended Drive Parameters (EBIOS)*
     266;   dw  Int13h_UnsupportedFunction                      ; 49h, Get Extended Disk Change Status (EBIOS)***
    235267;   dw  Int13h_UnsupportedFunction                      ; 4Ah, Initiate Disk Emulation (Bootable CD-ROM)
    236268;   dw  Int13h_UnsupportedFunction                      ; 4Bh, Terminate Disk Emulation (Bootable CD-ROM)
    237269;   dw  Int13h_UnsupportedFunction                      ; 4Ch, Initiate Disk Emulation and Boot (Bootable CD-ROM)
    238270;   dw  Int13h_UnsupportedFunction                      ; 4Dh, Return Boot Catalog (Bootable CD-ROM)
    239 ;   dw  Int13h_UnsupportedFunction                      ; 4Eh, Set Hardware Configuration (EBIOS)
     271;   dw  Int13h_UnsupportedFunction                      ; 4Eh, Set Hardware Configuration (EBIOS)**
     272;
     273;   * = Enhanced Drive Access Support (minimum required EBIOS functions)
     274;  ** = Enhanced Disk Drive (EDD) Support
     275; *** = Drive Locking and Ejecting Support
Note: See TracChangeset for help on using the changeset viewer.