Changeset 417 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers


Ignore:
Timestamp:
May 5, 2012, 4:01:03 PM (13 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • AT builds now relocate INT 13h stack to top of stolen conventional memory.
  • Some small fixes here and there.
Location:
trunk/XTIDE_Universal_BIOS/Src/Handlers
Files:
3 edited

Legend:

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

    r414 r417  
    2323;--------------------------------------------------------------------
    2424; Int 13h software interrupt handler.
     25; This handler changes stack to top of stolen conventional memory
     26; and then calls the actual INT 13h handler (Int13h_DiskFunctionsHandler).
     27;
     28; Int13h_DiskFunctionsHandlerWithStackChange
     29;   Parameters:
     30;       AH:     Bios function
     31;       DL:     Drive number
     32;       Other:  Depends on function
     33;   Returns:
     34;       Depends on function
     35;--------------------------------------------------------------------
     36%ifdef RELOCATE_INT13H_STACK
     37ALIGN JUMP_ALIGN
     38Int13h_DiskFunctionsHandlerWithStackChange:
     39    push    ds
     40    push    di
     41    call    RamVars_GetSegmentToDS
     42
     43    ; Store entry registers to RAMVARS
     44    mov     [RAMVARS.fpInt13hEntryStack], sp
     45    mov     [RAMVARS.fpInt13hEntryStack+2], ss
     46    pop     WORD [RAMVARS.wStackChangeDI]
     47    pop     WORD [RAMVARS.wStackChangeDS]
     48
     49    ; Load new stack and restore DS and DI
     50    mov     di, ds      ; We do not want to overwrite DS and DI in stack
     51    mov     ss, di
     52    mov     sp, [RAMVARS.wNewStackOffset]
     53    lds     di, [RAMVARS.dwStackChangeDSDI]
     54
     55    ; Call INT 13h
     56    pushf
     57    push    cs
     58    call    Int13h_DiskFunctionsHandler
     59
     60    ; Restore stack (we must not corrupt FLAGS!)
     61    cli
     62%ifdef USE_386
     63    lss     sp, [ss:RAMVARS.fpInt13hEntryStack]
     64%else
     65    mov     sp, [ss:RAMVARS.fpInt13hEntryStack]
     66    mov     ss, [ss:RAMVARS.fpInt13hEntryStack+2]
     67%endif
     68    pop     di          ; DI before stack change
     69    pop     ds          ; DS before stack change
     70    retf    2           ; Skip FLAGS from stack
     71%endif ; RELOCATE_INT13H_STACK
     72
     73
     74;--------------------------------------------------------------------
     75; Int 13h software interrupt handler.
    2576; Jumps to specific function defined in AH.
    2677;
     
    4091    cld                                 ; String instructions to increment pointers
    4192    CREATE_FRAME_INTPACK_TO_SSBP    EXTRA_BYTES_FOR_INTPACK
    42 
    4393    call    RamVars_GetSegmentToDS
    4494
     
    4797    mov     [RAMVARS.xlateVars+XLATEVARS.bXlatedDrv], dl
    4898%endif
    49 
    5099    call    FindDPT_ForDriveNumberInDL  ; DS:DI points to our DPT, or NULL if not our drive
    51100    jc      SHORT .NotOurDrive          ; DPT not found so this is not one of our drives
     
    56105    shl     bx, 1
    57106    cmp     ah, 25h                     ; Possible EBIOS function?
    58 %ifdef MODULE_EBIOS
     107%ifndef MODULE_EBIOS
     108    ja      SHORT UnsupportedFunction
     109    jmp     [cs:bx+g_rgw13hFuncJump]    ; Jump to BIOS function
     110
     111%else ; If using MODULE_EBIOS
    59112    ja      SHORT .JumpToEbiosFunction
    60 %else
    61     ja      SHORT Int13h_UnsupportedFunction
    62 %endif
    63113    jmp     [cs:bx+g_rgw13hFuncJump]    ; Jump to BIOS function
    64114
    65 %ifdef MODULE_EBIOS
    66     ; Jump to correct EBIOS function
    67115ALIGN JUMP_ALIGN
    68116.JumpToEbiosFunction:
    69117    test    BYTE [di+DPT.bFlagsLow], FLG_DRVNHEAD_LBA
    70     jz      SHORT Int13h_UnsupportedFunction    ; No eINT 13h for CHS drives
     118    jz      SHORT UnsupportedFunction   ; No eINT 13h for CHS drives
    71119    sub     bl, 41h<<1                  ; BX = Offset to eINT 13h jump table
    72     jb      SHORT Int13h_UnsupportedFunction
     120    jb      SHORT UnsupportedFunction
    73121    cmp     ah, 48h
    74     ja      SHORT Int13h_UnsupportedFunction
     122    ja      SHORT UnsupportedFunction
    75123    jmp     [cs:bx+g_rgwEbiosFunctionJumpTable]
    76 %endif
     124%endif  ; MODULE_EBIOS
     125
    77126
    78127ALIGN JUMP_ALIGN
     
    91140    ; Fall to Int13h_DirectCallToAnotherBios
    92141
    93 ;--------------------------------------------------------------------
    94 ; Int13h_UnsupportedFunction
     142
     143;--------------------------------------------------------------------
     144; UnsupportedFunction
    95145; Int13h_DirectCallToAnotherBios
    96146;   Parameters:
     
    106156;--------------------------------------------------------------------
    107157ALIGN JUMP_ALIGN
    108 Int13h_UnsupportedFunction:
     158UnsupportedFunction:
    109159Int13h_DirectCallToAnotherBios:
    110160    call    ExchangeCurrentInt13hHandlerWithOldInt13hHandler
     
    156206%endif
    157207
     208
    158209%ifdef MODULE_SERIAL_FLOPPY
    159210;--------------------------------------------------------------------
     
    166217Int13h_ReturnSuccessForFloppy:
    167218    test    dl, dl
    168     js      short Int13h_UnsupportedFunction
     219    js      SHORT UnsupportedFunction
    169220    xor     ah, ah
    170     jmp     short Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    171 %endif
     221    jmp     SHORT Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
     222%endif
     223
    172224
    173225;--------------------------------------------------------------------
     
    185237    ; Fall to Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    186238
     239
    187240;--------------------------------------------------------------------
    188241; Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
     
    190243;   Parameters:
    191244;       AH:     BIOS Error code
     245;       DS:     RAMVARS segment
    192246;       SS:BP:  Ptr to IDEPACK
    193247;   Returns:
     
    206260
    207261Int13h_ReturnFromHandlerWithoutStoringErrorCode:
    208     or      WORD [bp+IDEPACK.intpack+INTPACK.flags], FLG_FLAGS_IF   ; Return with interrupts enabled
    209     mov     sp, bp                                  ; Now we can exit anytime
     262    ; Always return with interrupts enabled since there are programs that rely
     263    ; on INT 13h to enable interrupts.
     264    or      BYTE [bp+IDEPACK.intpack+INTPACK.flags+1], (FLG_FLAGS_IF>>8)
     265    mov     sp, bp  ; This makes possible to exit anytime, no matter what is on stack
    210266    RESTORE_FRAME_INTPACK_FROM_SSBP     EXTRA_BYTES_FOR_INTPACK
    211267
     
    280336    LOAD_BDA_SEGMENT_TO ds, di
    281337    mov     [bx], ah
     338    ; Fall to Int13h_SetErrorCodeToIntpackInSSBPfromAH
     339
    282340%else
    283341Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH:
     
    285343    LOAD_BDA_SEGMENT_TO ds, di
    286344    mov     [BDA.bHDLastSt], ah
     345    ; Fall to Int13h_SetErrorCodeToIntpackInSSBPfromAH
    287346%endif
    288347
     
    302361ALIGN WORD_ALIGN
    303362g_rgw13hFuncJump:
    304     dw  AH0h_HandlerForDiskControllerReset              ; 00h, Disk Controller Reset (All)
    305     dw  AH1h_HandlerForReadDiskStatus                   ; 01h, Read Disk Status (All)
    306     dw  AH2h_HandlerForReadDiskSectors                  ; 02h, Read Disk Sectors (All)
    307     dw  AH3h_HandlerForWriteDiskSectors                 ; 03h, Write Disk Sectors (All)
    308     dw  AH4h_HandlerForVerifyDiskSectors                ; 04h, Verify Disk Sectors (All)
     363    dw  AH0h_HandlerForDiskControllerReset          ; 00h, Disk Controller Reset (All)
     364    dw  AH1h_HandlerForReadDiskStatus               ; 01h, Read Disk Status (All)
     365    dw  AH2h_HandlerForReadDiskSectors              ; 02h, Read Disk Sectors (All)
     366    dw  AH3h_HandlerForWriteDiskSectors             ; 03h, Write Disk Sectors (All)
     367    dw  AH4h_HandlerForVerifyDiskSectors            ; 04h, Verify Disk Sectors (All)
    309368%ifdef MODULE_SERIAL_FLOPPY
    310     dw  Int13h_ReturnSuccessForFloppy                   ; 05h, Format Disk Track (XT, AT, EISA)
    311 %else
    312     dw  Int13h_UnsupportedFunction                      ; 05h, Format Disk Track (XT, AT, EISA)
    313 %endif
    314     dw  Int13h_UnsupportedFunction                      ; 06h, Format Disk Track with Bad Sectors (XT)
    315     dw  Int13h_UnsupportedFunction                      ; 07h, Format Multiple Cylinders (XT)
    316     dw  AH8h_HandlerForReadDiskDriveParameters          ; 08h, Read Disk Drive Parameters (All)
    317     dw  AH9h_HandlerForInitializeDriveParameters        ; 09h, Initialize Drive Parameters (All)
    318     dw  Int13h_UnsupportedFunction                      ; 0Ah, Read Disk Sectors with ECC (XT, AT, EISA)
    319     dw  Int13h_UnsupportedFunction                      ; 0Bh, Write Disk Sectors with ECC (XT, AT, EISA)
    320     dw  AHCh_HandlerForSeek                             ; 0Ch, Seek (All)
    321     dw  AHDh_HandlerForResetHardDisk                    ; 0Dh, Alternate Disk Reset (All)
    322     dw  Int13h_UnsupportedFunction                      ; 0Eh, Read Sector Buffer (XT, PS/1), ESDI Undocumented Diagnostic (PS/2)
    323     dw  Int13h_UnsupportedFunction                      ; 0Fh, Write Sector Buffer (XT, PS/1), ESDI Undocumented Diagnostic (PS/2)
    324     dw  AH10h_HandlerForCheckDriveReady                 ; 10h, Check Drive Ready (All)
    325     dw  AH11h_HandlerForRecalibrate                     ; 11h, Recalibrate (All)
    326     dw  Int13h_UnsupportedFunction                      ; 12h, Controller RAM Diagnostic (XT)
    327     dw  Int13h_UnsupportedFunction                      ; 13h, Drive Diagnostic (XT)
    328     dw  Int13h_UnsupportedFunction                      ; 14h, Controller Internal Diagnostic (All)
    329     dw  AH15h_HandlerForReadDiskDriveSize               ; 15h, Read Disk Drive Size (AT+)
    330     dw  Int13h_UnsupportedFunction                      ; 16h,
    331     dw  Int13h_UnsupportedFunction                      ; 17h,
    332     dw  Int13h_UnsupportedFunction                      ; 18h,
    333     dw  Int13h_UnsupportedFunction                      ; 19h, Park Heads (PS/2)
    334     dw  Int13h_UnsupportedFunction                      ; 1Ah, Format ESDI Drive (PS/2)
    335     dw  Int13h_UnsupportedFunction                      ; 1Bh, Get ESDI Manufacturing Header (PS/2)
    336     dw  Int13h_UnsupportedFunction                      ; 1Ch, ESDI Special Functions (PS/2)
    337     dw  Int13h_UnsupportedFunction                      ; 1Dh,
    338     dw  Int13h_UnsupportedFunction                      ; 1Eh,
    339     dw  Int13h_UnsupportedFunction                      ; 1Fh,
    340     dw  Int13h_UnsupportedFunction                      ; 20h,
    341     dw  Int13h_UnsupportedFunction                      ; 21h, Read Disk Sectors, Multiple Blocks (PS/1)
    342     dw  Int13h_UnsupportedFunction                      ; 22h, Write Disk Sectors, Multiple Blocks (PS/1)
    343     dw  AH23h_HandlerForSetControllerFeatures           ; 23h, Set Controller Features Register (PS/1)
    344     dw  AH24h_HandlerForSetMultipleBlocks               ; 24h, Set Multiple Blocks (PS/1)
    345     dw  AH25h_HandlerForGetDriveInformation             ; 25h, Get Drive Information (PS/1)
     369    dw  Int13h_ReturnSuccessForFloppy               ; 05h, Format Disk Track (XT, AT, EISA)
     370%else
     371    dw  UnsupportedFunction                         ; 05h, Format Disk Track (XT, AT, EISA)
     372%endif
     373    dw  UnsupportedFunction                         ; 06h, Format Disk Track with Bad Sectors (XT)
     374    dw  UnsupportedFunction                         ; 07h, Format Multiple Cylinders (XT)
     375    dw  AH8h_HandlerForReadDiskDriveParameters      ; 08h, Read Disk Drive Parameters (All)
     376    dw  AH9h_HandlerForInitializeDriveParameters    ; 09h, Initialize Drive Parameters (All)
     377    dw  UnsupportedFunction                         ; 0Ah, Read Disk Sectors with ECC (XT, AT, EISA)
     378    dw  UnsupportedFunction                         ; 0Bh, Write Disk Sectors with ECC (XT, AT, EISA)
     379    dw  AHCh_HandlerForSeek                         ; 0Ch, Seek (All)
     380    dw  AHDh_HandlerForResetHardDisk                ; 0Dh, Alternate Disk Reset (All)
     381    dw  UnsupportedFunction                         ; 0Eh, Read Sector Buffer (XT, PS/1), ESDI Undocumented Diagnostic (PS/2)
     382    dw  UnsupportedFunction                         ; 0Fh, Write Sector Buffer (XT, PS/1), ESDI Undocumented Diagnostic (PS/2)
     383    dw  AH10h_HandlerForCheckDriveReady             ; 10h, Check Drive Ready (All)
     384    dw  AH11h_HandlerForRecalibrate                 ; 11h, Recalibrate (All)
     385    dw  UnsupportedFunction                         ; 12h, Controller RAM Diagnostic (XT)
     386    dw  UnsupportedFunction                         ; 13h, Drive Diagnostic (XT)
     387    dw  UnsupportedFunction                         ; 14h, Controller Internal Diagnostic (All)
     388    dw  AH15h_HandlerForReadDiskDriveSize           ; 15h, Read Disk Drive Size (AT+)
     389    dw  UnsupportedFunction                         ; 16h,
     390    dw  UnsupportedFunction                         ; 17h,
     391    dw  UnsupportedFunction                         ; 18h,
     392    dw  UnsupportedFunction                         ; 19h, Park Heads (PS/2)
     393    dw  UnsupportedFunction                         ; 1Ah, Format ESDI Drive (PS/2)
     394    dw  UnsupportedFunction                         ; 1Bh, Get ESDI Manufacturing Header (PS/2)
     395    dw  UnsupportedFunction                         ; 1Ch, ESDI Special Functions (PS/2)
     396    dw  UnsupportedFunction                         ; 1Dh,
     397    dw  UnsupportedFunction                         ; 1Eh,
     398    dw  UnsupportedFunction                         ; 1Fh,
     399    dw  UnsupportedFunction                         ; 20h,
     400    dw  UnsupportedFunction                         ; 21h, Read Disk Sectors, Multiple Blocks (PS/1)
     401    dw  UnsupportedFunction                         ; 22h, Write Disk Sectors, Multiple Blocks (PS/1)
     402    dw  AH23h_HandlerForSetControllerFeatures       ; 23h, Set Controller Features Register (PS/1)
     403    dw  AH24h_HandlerForSetMultipleBlocks           ; 24h, Set Multiple Blocks (PS/1)
     404    dw  AH25h_HandlerForGetDriveInformation         ; 25h, Get Drive Information (PS/1)
    346405
    347406%ifdef MODULE_EBIOS
    348407g_rgwEbiosFunctionJumpTable:
    349     dw  AH41h_HandlerForCheckIfExtensionsPresent        ; 41h, Check if Extensions Present (EBIOS)*
    350     dw  AH42h_HandlerForExtendedReadSectors             ; 42h, Extended Read Sectors (EBIOS)*
    351     dw  AH43h_HandlerForExtendedWriteSectors            ; 43h, Extended Write Sectors (EBIOS)*
    352     dw  AH44h_HandlerForExtendedVerifySectors           ; 44h, Extended Verify Sectors (EBIOS)*
    353     dw  Int13h_UnsupportedFunction                      ; 45h, Lock and Unlock Drive (EBIOS)***
    354     dw  Int13h_UnsupportedFunction                      ; 46h, Eject Media Request (EBIOS)***
    355     dw  AH47h_HandlerForExtendedSeek                    ; 47h, Extended Seek (EBIOS)*
    356     dw  AH48h_HandlerForGetExtendedDriveParameters      ; 48h, Get Extended Drive Parameters (EBIOS)*
    357 ;   dw  Int13h_UnsupportedFunction                      ; 49h, Get Extended Disk Change Status (EBIOS)***
    358 ;   dw  Int13h_UnsupportedFunction                      ; 4Ah, Initiate Disk Emulation (Bootable CD-ROM)
    359 ;   dw  Int13h_UnsupportedFunction                      ; 4Bh, Terminate Disk Emulation (Bootable CD-ROM)
    360 ;   dw  Int13h_UnsupportedFunction                      ; 4Ch, Initiate Disk Emulation and Boot (Bootable CD-ROM)
    361 ;   dw  Int13h_UnsupportedFunction                      ; 4Dh, Return Boot Catalog (Bootable CD-ROM)
    362 ;   dw  Int13h_UnsupportedFunction                      ; 4Eh, Set Hardware Configuration (EBIOS)**
     408    dw  AH41h_HandlerForCheckIfExtensionsPresent    ; 41h, Check if Extensions Present (EBIOS)*
     409    dw  AH42h_HandlerForExtendedReadSectors         ; 42h, Extended Read Sectors (EBIOS)*
     410    dw  AH43h_HandlerForExtendedWriteSectors        ; 43h, Extended Write Sectors (EBIOS)*
     411    dw  AH44h_HandlerForExtendedVerifySectors       ; 44h, Extended Verify Sectors (EBIOS)*
     412    dw  UnsupportedFunction                         ; 45h, Lock and Unlock Drive (EBIOS)***
     413    dw  UnsupportedFunction                         ; 46h, Eject Media Request (EBIOS)***
     414    dw  AH47h_HandlerForExtendedSeek                ; 47h, Extended Seek (EBIOS)*
     415    dw  AH48h_HandlerForGetExtendedDriveParameters  ; 48h, Get Extended Drive Parameters (EBIOS)*
     416;   dw  UnsupportedFunction                         ; 49h, Get Extended Disk Change Status (EBIOS)***
     417;   dw  UnsupportedFunction                         ; 4Ah, Initiate Disk Emulation (Bootable CD-ROM)
     418;   dw  UnsupportedFunction                         ; 4Bh, Terminate Disk Emulation (Bootable CD-ROM)
     419;   dw  UnsupportedFunction                         ; 4Ch, Initiate Disk Emulation and Boot (Bootable CD-ROM)
     420;   dw  UnsupportedFunction                         ; 4Dh, Return Boot Catalog (Bootable CD-ROM)
     421;   dw  UnsupportedFunction                         ; 4Eh, Set Hardware Configuration (EBIOS)**
    363422;
    364423;   * = Enhanced Drive Access Support (minimum required EBIOS functions)
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH41h_CheckIfExtensionsPresent.asm

    r376 r417  
    4747    jmp     Int13h_ReturnFromHandlerWithoutStoringErrorCode
    4848.EbiosNotSupported:
    49     jmp     Int13h_UnsupportedFunction
     49    jmp     Int13h_DirectCallToAnotherBios
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm

    r414 r417  
    126126    call    HotkeyBar_GetPrimaryBootDriveNumberToDL
    127127%else
    128     call    GetPrimaryBootDriveToDLwhenNotUsingModuleHotkeys
     128    xor     dl, dl          ; Try to boot from Floppy Drive A
    129129%endif  ; MODULE_HOTKEYS
    130130
     
    137137    call    HotkeyBar_GetSecondaryBootDriveNumberToDL
    138138%else
    139     call    GetPrimaryBootDriveToDLwhenNotUsingModuleHotkeys
    140     xor     dl, 80h
     139    mov     dl, 80h         ; Try to boot from Hard Drive C
    141140%endif
    142141    call    TryToBootFromPrimaryOrSecondaryBootDevice
     
    213212    jmp     BootSector_TryToLoadFromDriveDL
    214213%endif
    215 
    216 
    217 ;--------------------------------------------------------------------
    218 ; GetPrimaryBootDriveToDLwhenNotUsingModuleHotkeys
    219 ;   Parameters
    220 ;       Nothing
    221 ;   Returns:
    222 ;       DL:     Drive to boot from (00h or 80h)
    223 ;   Corrupts registers:
    224 ;       Nothing
    225 ;--------------------------------------------------------------------
    226 %ifndef MODULE_HOTKEYS
    227 GetPrimaryBootDriveToDLwhenNotUsingModuleHotkeys:
    228     mov     dl, [cs:ROMVARS.bBootDrv]
    229     and     dl, 80h     ; Only 00h and 80h allowed when not using MODULE_HOTKEYS
    230     ret
    231 %endif
Note: See TracChangeset for help on using the changeset viewer.