Changeset 165 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS


Ignore:
Timestamp:
Aug 20, 2011, 6:37:44 PM (13 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Hopefully this commit is successful. Sorry for the mess.
Location:
trunk/XTIDE_Universal_BIOS
Files:
11 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc

    r158 r165  
    4545; Bit definitions for DPT.bFlagsHigh
    4646FLGH_DPT_REVERSED_A0_AND_A3     EQU (1<<0)  ; XTIDE mod, Address lines 0 and 3 reversed
    47 FLGH_DPT_SERIAL_DEVICE          EQU (1<<1)  ; Serial Port Device
    48 FLGH_DPT_BLOCK_MODE_SUPPORTED   EQU (1<<2)  ; Use block transfer commands
     47FLGH_DPT_BLOCK_MODE_SUPPORTED   EQU (1<<1)  ; Use block transfer commands (must be bit 1!)
     48FLGH_DPT_SERIAL_DEVICE          EQU (1<<2)  ; Serial Port Device
    4949FLGH_DPT_INTERRUPT_IN_SERVICE   EQU (1<<3)  ; Set when waiting for IRQ
    5050FLGH_DPT_RESET_nDRDY            EQU (1<<4)  ; Drive ready to accept commands
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootInfo.asm

    r128 r165  
    3838.StoreSectorCount:
    3939    push    bx
    40     call    AtaID_GetTotalSectorCount       ; Get to BX:DX:AX
     40    call    AtaID_GetTotalSectorCountToBXDXAXfromAtaInfoInESSI
    4141    mov     cx, bx                          ; Now in CX:DX:AX
    4242    pop     bx
  • trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm

    r158 r165  
    1919    mov     bp, sp
    2020    jmp     ax
     21
     22
     23;--------------------------------------------------------------------
     24; Idepack_ConvertDapToIdepackAndIssueCommandFromAH
     25;   Parameters:
     26;       AH:     IDE command to issue
     27;       BH:     Timeout ticks
     28;       BL:     IDE Status Register flag to wait after command
     29;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     30;       ES:SI:  Ptr to DAP (EBIOS Disk Address Packet)
     31;       SS:BP:  Ptr to IDEPACK
     32;   Returns:
     33;       AH:     INT 13h Error Code
     34;       CF:     Cleared if success, Set if error
     35;   Corrupts registers:
     36;       AL, BX, CX, DX, SI, ES
     37;--------------------------------------------------------------------
     38ALIGN JUMP_ALIGN
     39Idepack_ConvertDapToIdepackAndIssueCommandFromAH:
     40    mov     [bp+IDEPACK.bCommand], ah
     41    mov     ax, [es:si+DAP.wSectorCount]
     42    mov     [bp+IDEPACK.bSectorCount], al
     43    mov     [bp+IDEPACK.bSectorCountHighExt], ah    ; Always zero
     44
     45    mov     al, [es:si+DAP.qwLBA]       ; LBA byte 0
     46    mov     [bp+IDEPACK.bLbaLow], al
     47    mov     ax, [es:si+DAP.qwLBA+1]     ; LBA bytes 1 and 2
     48    mov     [bp+IDEPACK.wLbaMiddleAndHigh], ax
     49    mov     ah, [es:si+DAP.qwLBA+3]     ; LBA byte 3, LBA28 bits 24...27
     50    mov     [bp+IDEPACK.bLbaLowExt], ah
     51    mov     cx, [es:si+DAP.qwLBA+4]     ; LBA bytes 4 and 5
     52    mov     [bp+IDEPACK.wLbaMiddleAndHighExt], cx
     53
     54    and     ah, 0Fh                     ; Limit bits for LBA28
     55    call    AccessDPT_GetDriveSelectByteToAL
     56    or      al, ah
     57    mov     [bp+IDEPACK.bDrvAndHead], al
     58    les     si, [es:si+DAP.dwMemoryAddress]
     59    jmp     SHORT GetDeviceControlByteToIdepackAndStartTransfer
    2160
    2261
     
    5695    pop     bx
    5796
     97GetDeviceControlByteToIdepackAndStartTransfer:
    5898    call    AccessDPT_GetDeviceControlByteToAL
    5999    mov     [bp+IDEPACK.bDeviceControl], al
    60     jmp     Device_OutputCommandWithParameters
     100    jmp     Device_OutputCommandWithParameters 
    61101
    62102
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm

    r161 r165  
    3333
    3434    ; Jump to correct BIOS function
    35     cmp     ah, 25h                     ; Valid BIOS function?
    36     ja      SHORT Int13h_UnsupportedFunction
    3735    eMOVZX  bx, ah
    3836    shl     bx, 1
     37    cmp     ah, 25h                     ; Possible EBIOS function?
     38    ja      SHORT .JumpToEbiosFunction
    3939    jmp     [cs:bx+g_rgw13hFuncJump]    ; Jump to BIOS function
     40
     41    ; Jump to correct EBIOS function
     42ALIGN JUMP_ALIGN
     43.JumpToEbiosFunction:
     44    test    BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE  ; Full mode?
     45    jz      SHORT Int13h_UnsupportedFunction
     46    test    BYTE [di+DPT.bFlagsLow], FLG_DRVNHEAD_LBA       ; LBA supported?
     47    jz      SHORT Int13h_UnsupportedFunction
     48    cmp     ah, 48h                     ; Above last valid function?
     49    ja      SHORT Int13h_UnsupportedFunction
     50    sub     bx, 41h<<1                  ; BX = Offset to EBIOS jump table
     51    jl      SHORT Int13h_UnsupportedFunction
     52    jmp     [cs:bx+g_rgwEbiosFunctionJumpTable]
    4053
    4154
     
    227240    dw  AH24h_HandlerForSetMultipleBlocks               ; 24h, Set Multiple Blocks (PS/1)
    228241    dw  AH25h_HandlerForGetDriveInformation             ; 25h, Get Drive Information (PS/1)
    229 ;   dw  Int13h_UnsupportedFunction                      ; 26h,
    230 ;   dw  Int13h_UnsupportedFunction                      ; 27h,
    231 ;   dw  Int13h_UnsupportedFunction                      ; 28h,
    232 ;   dw  Int13h_UnsupportedFunction                      ; 29h,
    233 ;   dw  Int13h_UnsupportedFunction                      ; 2Ah,
    234 ;   dw  Int13h_UnsupportedFunction                      ; 2Bh,
    235 ;   dw  Int13h_UnsupportedFunction                      ; 2Ch,
    236 ;   dw  Int13h_UnsupportedFunction                      ; 2Dh,
    237 ;   dw  Int13h_UnsupportedFunction                      ; 2Eh,
    238 ;   dw  Int13h_UnsupportedFunction                      ; 2Fh,
    239 ;   dw  Int13h_UnsupportedFunction                      ; 30h,
    240 ;   dw  Int13h_UnsupportedFunction                      ; 31h,
    241 ;   dw  Int13h_UnsupportedFunction                      ; 32h,
    242 ;   dw  Int13h_UnsupportedFunction                      ; 33h,
    243 ;   dw  Int13h_UnsupportedFunction                      ; 34h,
    244 ;   dw  Int13h_UnsupportedFunction                      ; 35h,
    245 ;   dw  Int13h_UnsupportedFunction                      ; 36h,
    246 ;   dw  Int13h_UnsupportedFunction                      ; 37h,
    247 ;   dw  Int13h_UnsupportedFunction                      ; 38h,
    248 ;   dw  Int13h_UnsupportedFunction                      ; 39h,
    249 ;   dw  Int13h_UnsupportedFunction                      ; 3Ah,
    250 ;   dw  Int13h_UnsupportedFunction                      ; 3Bh,
    251 ;   dw  Int13h_UnsupportedFunction                      ; 3Ch,
    252 ;   dw  Int13h_UnsupportedFunction                      ; 3Dh,
    253 ;   dw  Int13h_UnsupportedFunction                      ; 3Eh,
    254 ;   dw  Int13h_UnsupportedFunction                      ; 3Fh,
    255 ;   dw  Int13h_UnsupportedFunction                      ; 40h,
    256 ;   dw  Int13h_UnsupportedFunction                      ; 41h, Check if Extensions Present (EBIOS)*
    257 ;   dw  Int13h_UnsupportedFunction                      ; 42h, Extended Read Sectors (EBIOS)*
    258 ;   dw  Int13h_UnsupportedFunction                      ; 43h, Extended Write Sectors (EBIOS)*
    259 ;   dw  Int13h_UnsupportedFunction                      ; 44h, Extended Verify Sectors (EBIOS)*
    260 ;   dw  Int13h_UnsupportedFunction                      ; 45h, Lock and Unlock Drive (EBIOS)***
    261 ;   dw  Int13h_UnsupportedFunction                      ; 46h, Eject Media Request (EBIOS)***
    262 ;   dw  Int13h_UnsupportedFunction                      ; 47h, Extended Seek (EBIOS)*
    263 ;   dw  Int13h_UnsupportedFunction                      ; 48h, Get Extended Drive Parameters (EBIOS)*
     242
     243g_rgwEbiosFunctionJumpTable:
     244    dw  AH41h_HandlerForCheckIfExtensionsPresent        ; 41h, Check if Extensions Present (EBIOS)*
     245    dw  AH42h_HandlerForExtendedReadSectors             ; 42h, Extended Read Sectors (EBIOS)*
     246    dw  AH43h_HandlerForExtendedWriteSectors            ; 43h, Extended Write Sectors (EBIOS)*
     247    dw  AH44h_HandlerForExtendedVerifySectors           ; 44h, Extended Verify Sectors (EBIOS)*
     248    dw  Int13h_UnsupportedFunction                      ; 45h, Lock and Unlock Drive (EBIOS)***
     249    dw  Int13h_UnsupportedFunction                      ; 46h, Eject Media Request (EBIOS)***
     250    dw  AH47h_HandlerForExtendedSeek                    ; 47h, Extended Seek (EBIOS)*
     251    dw  AH48h_HandlerForGetExtendedDriveParameters      ; 48h, Get Extended Drive Parameters (EBIOS)*
    264252;   dw  Int13h_UnsupportedFunction                      ; 49h, Get Extended Disk Change Status (EBIOS)***
    265253;   dw  Int13h_UnsupportedFunction                      ; 4Ah, Initiate Disk Emulation (Bootable CD-ROM)
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH25h_HDrvID.asm

    r150 r165  
    2222ALIGN JUMP_ALIGN
    2323AH25h_HandlerForGetDriveInformation:
     24    mov     si, [bp+IDEPACK.intpack+INTPACK.bx]
     25%ifdef USE_186
     26    push    Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
     27    ; Fall to AH25h_GetDriveInformationToBufferInESSIfromDriveInDL
     28%else
     29    call    AH25h_GetDriveInformationToBufferInESSIfromDriveInDL
     30    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
     31%endif
     32
     33
     34;--------------------------------------------------------------------
     35; AH25h_GetDriveInformationToBufferInESSIfromDriveInDL
     36;   Parameters:
     37;       DL:     Translated Drive number
     38;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     39;       ES:SI:  Ptr to buffer to receive 512-byte drive information
     40;   Returns with INTPACK:
     41;       AH:     Int 13h return status
     42;       CF:     0 if succesfull, 1 if error
     43;   Corrupts registers:
     44;       AL, BX, CX, DX
     45;--------------------------------------------------------------------
     46AH25h_GetDriveInformationToBufferInESSIfromDriveInDL:
     47    push    es
    2448    push    bp
     49    push    di
     50    push    si
    2551
    26     mov     si, [bp+IDEPACK.intpack+INTPACK.bx]
    2752    call    AccessDPT_GetDriveSelectByteToAL
    2853    mov     bh, al
     
    3156    call    Device_IdentifyToBufferInESSIwithDriveSelectByteInBH
    3257
     58    pop     si
     59    pop     di
    3360    pop     bp
    34     jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
     61    pop     es
     62    ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH2h_HRead.asm

    r158 r165  
    1515;       SS:BP:  Ptr to IDEPACK
    1616;   Parameters on INTPACK:
    17 ;       AL:     Number of sectors to read (1...255)
     17;       AL:     Number of sectors to read (1...127)
    1818;       CH:     Cylinder number, bits 7...0
    1919;       CL:     Bits 7...6: Cylinder number bits 9 and 8
     
    2929AH2h_HandlerForReadDiskSectors:
    3030    cmp     BYTE [bp+IDEPACK.intpack+INTPACK.al], 0
    31     je      SHORT AH2h_ExitInt13hSinceSectorCountInIntpackIsZero
     31    jle     SHORT AH2h_ExitInt13hSinceSectorCountInIntpackIsZero
    3232
    33     mov     ah, COMMAND_READ_SECTORS    ; Load sector mode command
    34     test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED
    35     eCMOVNZ ah, COMMAND_READ_MULTIPLE   ; Load block mode command
     33    xor     bx, bx
     34    call    CommandLookup_OrOldInt13hIndexToBL
     35    mov     ah, [cs:bx+g_rgbReadCommandLookup]
    3636    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ)
    3737    mov     si, [bp+IDEPACK.intpack+INTPACK.bx]
     
    5555    mov     ah, RET_HD_INVALID
    5656    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
     57
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH3h_HWrite.asm

    r158 r165  
    1515;       SS:BP:  Ptr to IDEREGS_AND_INTPACK
    1616;   Parameters on INTPACK:
    17 ;       AL:     Number of sectors to write
     17;       AL:     Number of sectors to write (1...127)
    1818;       CH:     Cylinder number, bits 7...0
    1919;       CL:     Bits 7...6: Cylinder number bits 9 and 8
     
    2828AH3h_HandlerForWriteDiskSectors:
    2929    cmp     BYTE [bp+IDEPACK.intpack+INTPACK.al], 0
    30     je      SHORT AH2h_ExitInt13hSinceSectorCountInIntpackIsZero
     30    jle     SHORT AH2h_ExitInt13hSinceSectorCountInIntpackIsZero
    3131
    32     mov     ah, COMMAND_WRITE_SECTORS   ; Load sector mode command
    33     test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED
    34     eCMOVNZ ah, COMMAND_WRITE_MULTIPLE  ; Load block mode command
     32    xor     bx, bx
     33    call    CommandLookup_OrOldInt13hIndexToBL
     34    mov     ah, [cs:bx+g_rgbWriteCommandLookup]
    3535    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ)
    3636    mov     si, [bp+IDEPACK.intpack+INTPACK.bx]
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH4h_HVerify.asm

    r158 r165  
    1515;       SS:BP:  Ptr to INTPACK
    1616;   Parameters on INTPACK in SS:BP:
    17 ;       AL:     Number of sectors to verify
     17;       AL:     Number of sectors to verify (1...127)
    1818;       CH:     Cylinder number, bits 7...0
    1919;       CL:     Bits 7...6: Cylinder number bits 9 and 8
     
    2727AH4h_HandlerForVerifyDiskSectors:
    2828    cmp     BYTE [bp+IDEPACK.intpack+INTPACK.al], 0
    29     je      SHORT AH2h_ExitInt13hSinceSectorCountInIntpackIsZero
     29    jle     SHORT AH2h_ExitInt13hSinceSectorCountInIntpackIsZero
    3030
    3131    mov     ah, COMMAND_VERIFY_SECTORS
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm

    r99 r165  
    2525
    2626;--------------------------------------------------------------------
    27 ; AtaID_GetTotalSectorCount
     27; AtaID_GetTotalSectorCountToBXDXAXfromAtaInfoInESSI
    2828;   Parameters:
    2929;       ES:SI:  Ptr to 512-byte ATA information read from the drive
     
    3333;       Nothing
    3434;--------------------------------------------------------------------
    35 AtaID_GetTotalSectorCount:
     35AtaID_GetTotalSectorCountToBXDXAXfromAtaInfoInESSI:
    3636    push    ds
    3737
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r160 r165  
    1919%include "IdeRegisters.inc"     ; For ATA Registers, flags and commands
    2020%include "Int13h.inc"           ; Equates for INT 13h functions
     21%include "EBIOS.inc"            ; Equates for EBIOS functions
    2122%include "CustomDPT.inc"        ; For Disk Parameter Table
    2223%include "RomVars.inc"          ; For ROMVARS and IDEVARS structs
     
    171172%include "DriveXlate.asm"       ; For swapping drive numbers
    172173%include "Address.asm"          ; For sector address translations
     174%include "CommandLookup.asm"    ; For getting correct transfer command
    173175%include "Int13h.asm"           ; For Int 13h, Disk functions
    174176%include "AH0h_HReset.asm"      ; Required by Int13h_Jump.asm
     
    187189%include "AH24h_HSetBlocks.asm" ; Required by Int13h_Jump.asm
    188190%include "AH25h_HDrvID.asm"     ; Required by Int13h_Jump.asm
     191%include "AH41h_CheckIfExtensionsPresent.asm"
     192%include "AH42h_ExtendedReadSectors.asm"
     193%include "AH43h_ExtendedWriteSectors.asm"
     194%include "AH44h_ExtendedVerifySectors.asm"
     195%include "AH47h_ExtendedSeek.asm"
     196%include "AH48h_GetExtendedDriveParameters.asm"
    189197
    190198
  • trunk/XTIDE_Universal_BIOS/makefile

    r155 r165  
    3838HEADERS += Src/Handlers/
    3939HEADERS += Src/Handlers/Int13h/
     40HEADERS += Src/Handlers/Int13h/EBIOS/
     41HEADERS += Src/Handlers/Int13h/Tools/
    4042HEADERS += Src/Device/
    4143HEADERS += Src/Device/IDE/
Note: See TracChangeset for help on using the changeset viewer.