Changeset 568 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS


Ignore:
Timestamp:
Dec 21, 2014, 5:37:53 PM (9 years ago)
Author:
krille_n_@…
google:author:
krille_n_@hotmail.com
Message:

Changes:

  • SerDrive: Using named pipe mode (serdrive -p) now works under Windows XP/2000/Server 2003.
  • checksum.pl: Added a compatibility fix for 3Com 3C503 cards.
  • XTIDECFG will now scan every possible segment address to find and load the BIOS and/or its settings from EEPROM. This should simplify things for people using combined option ROMs.
  • Fixed a bug from r521 in BootSector.asm where the BIOS would not display a timeout error if it failed to load the boot sector from harddrive.
  • Fixed a bug from r541 in CompatibleDPT.asm where CompatibleDPT_CreateDeviceParameterTableExtensionToESBXfromDPTinDSSI would generate an invalid checksum in the DPTE.
  • Optimizations and other fixes.
Location:
trunk/XTIDE_Universal_BIOS/Src
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm

    r526 r568  
    4747%ifdef MODULE_SERIAL    ; IDE + Serial
    4848Device_FinalizeDPT:
    49     ; needs to check IDEVARS vs. checking the DPT as the serial bit in the DPT is set in the Finalize routine
    50     CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF   DEVICE_SERIAL_PORT, .FinalizeDptForSerialPortDevice
     49    ; Needs to check IDEVARS vs. checking the DPT as the serial bit in the DPT is set in the Finalize routine
     50    cmp     BYTE [cs:bp+IDEVARS.bDevice], DEVICE_SERIAL_PORT
     51%ifdef USE_386
     52    jne     IdeDPT_Finalize
     53    jmp     SerialDPT_Finalize
     54%else
     55    je      SHORT .FinalizeDptForSerialPortDevice
    5156    jmp     IdeDPT_Finalize
    5257.FinalizeDptForSerialPortDevice:
    5358    jmp     SerialDPT_Finalize
     59%endif
    5460
    5561%else                   ; IDE
     
    94100%ifdef MODULE_SERIAL    ; IDE + Serial
    95101Device_IdentifyToBufferInESSIwithDriveSelectByteInBH:
    96     CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF   DEVICE_SERIAL_PORT, .IdentifyDriveFromSerialPort
     102    cmp     BYTE [cs:bp+IDEVARS.bDevice], DEVICE_SERIAL_PORT
     103%ifdef USE_386
     104    jne     IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
     105    jmp     SerialCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
     106%else
     107    je      SHORT .IdentifyDriveFromSerialPort
    97108    jmp     IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
    98109.IdentifyDriveFromSerialPort:
    99110    jmp     SerialCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
     111%endif
    100112
    101113%else                   ; IDE
     
    122134ALIGN JUMP_ALIGN
    123135Device_OutputCommandWithParameters:
    124     TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE .OutputCommandToSerialPort
     136    test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
     137%ifdef USE_386
     138    jz      IdeCommand_OutputWithParameters
     139    jmp     SerialCommand_OutputWithParameters
     140%else
     141    jnz     SHORT .OutputCommandToSerialPort
    125142    jmp     IdeCommand_OutputWithParameters
    126143
     
    128145.OutputCommandToSerialPort:
    129146    jmp     SerialCommand_OutputWithParameters
     147%endif
    130148
    131149%else                   ; IDE
     
    147165%ifdef MODULE_SERIAL    ; IDE + Serial
    148166Device_SelectDrive:
    149     TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE    ReturnSuccessForSerialPort
     167    test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
     168%ifndef USE_386
     169    jnz     SHORT ReturnSuccessForSerialPort
    150170    jmp     IdeCommand_SelectDrive
     171%else
     172    jz      IdeCommand_SelectDrive
     173    ; Fall to ReturnSuccessForSerialPort
     174%endif
    151175
    152176%else                   ; IDE
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm

    r567 r568  
    189189    mov     cl, [bp+PIOVARS.bSectorsLeft]       ; CH is already zero
    190190    push    cx
    191 %ifdef USE_186
    192     push    CheckErrorsAfterTransferringLastBlock
    193     jmp     [bp+PIOVARS.fnXfer]                 ; Transfer possibly partial block
    194 %else
    195191    call    [bp+PIOVARS.fnXfer]                 ; Transfer possibly partial block
    196192    jmp     SHORT CheckErrorsAfterTransferringLastBlock
    197 %endif
    198193
    199194
     
    241236
    242237    ; Convert ES:SI to physical address
    243 %ifdef USE_186
     238%ifdef USE_386
     239
     240    mov     dx, es
     241    xor     ax, ax
     242    shld    ax, dx, 4
     243    shl     dx, 4
     244    add     si, dx
     245    adc     al, ah
     246    mov     es, ax
     247
     248%elifdef USE_186
    244249                        ; Bytes EU Cycles(286)
    245250    mov     ax, es      ; 2     2
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm

    r567 r568  
    322322
    323323;--------------------------------------------------------------------
     324; Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH_ALHasDriveNumber
    324325; Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH
    325326; Int13h_SetErrorCodeToIntpackInSSBPfromAH
     
    330331;       SS:BP:  Ptr to IDEPACK with error condition set
    331332;   Corrupts registers:
    332 ;       DS, DI
     333;       DS, BX, DI
    333334;--------------------------------------------------------------------
    334335ALIGN JUMP_ALIGN
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH4h_HVerify.asm

    r526 r568  
    3838;   Returns with INTPACK in SS:BP:
    3939;       AH:     Int 13h/40h floppy return status
    40 ;       AL:     Number of sectors actually verified (only valid if CF set for someBIOSes)
     40;       AL:     Number of sectors actually verified (only valid if CF set for some BIOSes)
    4141;       CF:     0 if successful, 1 if error
    4242;--------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH43h_ExtendedWriteSectors.asm

    r526 r568  
    4848    mov     ah, [cs:bx+g_rgbWriteCommandLookup]
    4949    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ)
    50 %ifdef USE_186
    51     push    AH42h_ReturnFromInt13hAfterStoringErrorCodeFromAHandTransferredSectorsFromCX
    52     jmp     Idepack_ConvertDapToIdepackAndIssueCommandFromAH
    53 %else
    5450    call    Idepack_ConvertDapToIdepackAndIssueCommandFromAH
    5551    jmp     SHORT AH42h_ReturnFromInt13hAfterStoringErrorCodeFromAHandTransferredSectorsFromCX
    56 %endif
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH44h_ExtendedVerifySectors.asm

    r526 r568  
    4343    mov     ah, [cs:bx+g_rgbVerifyCommandLookup]
    4444    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRDY)
    45 %ifdef USE_186
    46     push    AH42h_ReturnFromInt13hAfterStoringErrorCodeFromAHandTransferredSectorsFromCX
    47     jmp     Idepack_ConvertDapToIdepackAndIssueCommandFromAH
    48 %else
    4945    call    Idepack_ConvertDapToIdepackAndIssueCommandFromAH
    5046    jmp     SHORT AH42h_ReturnFromInt13hAfterStoringErrorCodeFromAHandTransferredSectorsFromCX
    51 %endif
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH48h_GetExtendedDriveParameters.asm

    r550 r568  
    147147    ; from previously scanned drive.
    148148.DoNotSetChsFlag:
    149     eMOVZX  dx, BYTE [es:si+DPT.bPchsHeads]
     149    eMOVZX  dx, [es:si+DPT.bPchsHeads]
    150150    mov     [di+EDRIVE_INFO.dwHeads], dx
    151151    mov     [di+EDRIVE_INFO.dwHeads+2], cx
     
    159159    mov     [di+EDRIVE_INFO.dwCylinders+2], cx
    160160
    161 .ReturnWithSuccess:
    162     xor     ax, ax
    163 .ReturnWithError:
     161    xor     ax, ax      ; Success
    164162    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Address.asm

    r542 r568  
    3737ALIGN JUMP_ALIGN
    3838Address_ExtractLCHSparametersFromOldInt13hAddress:
    39     mov     bl, cl              ; Copy sector number...
    40     and     bl, 3Fh             ; ...and limit to 1...63
     39    mov     bl, 3Fh             ; Load sector number mask
     40    and     bl, cl              ; Sector number now in BL
    4141    sub     cl, bl              ; Remove from cylinder number high
    4242    eROL_IM cl, 2               ; High bits to beginning
     
    7575    ; (LCylinder << n) + (LHead / PHeadCount)
    7676    mov     dx, cx                  ; Copy L-CHS Cylinder number to DX
    77     mov     cl, [di+DPT.bFlagsLow]  ; Load shift count
    78     and     cl, MASKL_DPT_CHS_SHIFT_COUNT
     77    mov     cl, MASKL_DPT_CHS_SHIFT_COUNT   ; Load shift count mask
     78    and     cl, [di+DPT.bFlagsLow]  ; Shift count now in CL
    7979    shl     dx, cl                  ; DX = LCylinder << n
    8080    add     ax, dx                  ; AX = P-CHS Cylinder number
     
    8383    ret
    8484
     85; *FIXME* The above function description doesn't match the code.
     86; If CX has a maximum value of 1023 on entry then there is no way CX can be 16382 on return.
     87; 1023 SHL 3 (MASKL_DPT_CHS_SHIFT_COUNT) is 8184. With the addition of AX (at most 255?)
     88; the result is 8439.
    8589
    8690;--------------------------------------------------------------------
     
    102106ALIGN JUMP_ALIGN
    103107Address_OldInt13hAddressToIdeAddress:
    104         call    Address_ExtractLCHSparametersFromOldInt13hAddress
    105         ACCESSDPT__GET_UNSHIFTED_TRANSLATE_MODE_TO_AXZF
     108    call    Address_ExtractLCHSparametersFromOldInt13hAddress
     109    mov     al, [di+DPT.bFlagsLow]
     110    and     al, MASKL_DPT_TRANSLATEMODE
    106111
    107112;;; 0: ADDRESSING_MODE_NORMAL
    108         jz      SHORT DoNotConvertLCHS
     113    jz      SHORT DoNotConvertLCHS
    109114
    110115;;; 1: ADDRESSING_MODE_LARGE
    111         test    al, FLGL_DPT_ASSISTED_LBA
    112         jz      SHORT ConvertLargeModeLCHStoPCHS
     116    test    al, FLGL_DPT_ASSISTED_LBA
     117    jz      SHORT ConvertLargeModeLCHStoPCHS
    113118
    114119;;; 2: ADDRESSING_MODE_ASSISTED_LBA
    115         ; Fall through to ConvertAssistedLBAModeLCHStoLBARegisterValues
     120    ; Fall to ConvertAssistedLBAModeLCHStoLBARegisterValues
    116121
    117122
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Prepare.asm

    r567 r568  
    4646    ; Make sure that sector count is valid
    4747%ifdef USE_UNDOC_INTEL
    48     eSALC   ; Clear AL using CF (CF is cleared since JB above fell through)
     48    salc    ; Clear AL using CF (CF is cleared since JB above fell through)
    4949    or      al, [es:si+DAP.wSectorCount]
    5050%else
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h/BootSector.asm

    r528 r568  
    4242    ; display error code every time user intends to boot from hard disk
    4343    ; when A then C boot order is used.
     44    test    dl, dl
    4445    js      SHORT .PrintFailedToLoadErrorCode   ; Hard Drive
    4546    cmp     ah, RET_HD_TIMEOUT
     
    4849    je      SHORT .ReturnWithCFclearSinceFailedToLoadBootSector
    4950.PrintFailedToLoadErrorCode:
    50 %ifdef USE_186
    51     push    .ReturnWithCFclearSinceFailedToLoadBootSector
    52     jmp     DetectPrint_FailedToLoadFirstSector
    53 %else
    5451    call    DetectPrint_FailedToLoadFirstSector
    55     jmp     .ReturnWithCFclearSinceFailedToLoadBootSector
    56 %endif
     52    jmp     SHORT .ReturnWithCFclearSinceFailedToLoadBootSector
    5753
    5854
     
    6359    jne     SHORT .FirstHardDiskSectorNotBootable
    6460.AlwaysBootFromFloppyDriveForBooterGames:
    65     stc     ; Boot Sector loaded succesfully
     61    stc     ; Boot Sector loaded successfully
    6662    jmp     SHORT Int19_JumpToBootSectorOrRomBoot
    6763
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/AdvAtaInit.asm

    r567 r568  
    136136    mov     cx, [di+DPT_ADVANCED_ATA.wMinPioCycleTime]
    137137    test    si, si
    138     jz      SHORT .PioTimingsLoadedToAXandCX
     138    jz      SHORT .PioTimingsLoadedToBXandCX
    139139    MIN_U   bl, [si+DPT_ADVANCED_ATA.bPioMode]
    140140    MAX_U   cx, [si+DPT_ADVANCED_ATA.wMinPioCycleTime]
    141 .PioTimingsLoadedToAXandCX:
     141.PioTimingsLoadedToBXandCX:
    142142    ret
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm

    r567 r568  
    107107    call    AccessDPT_GetPointerToDRVPARAMStoCSBX
    108108    push    ds
     109
     110    push    cs
     111    pop     ds
     112
     113    ; Load User Defined CHS or LBA to CX:AX
     114    mov     dx, [bx+DRVPARAMS.wFlags]
     115    mov     ax, [bx+DRVPARAMS.wCylinders]       ; Or .dwMaximumLBA
     116    mov     cx, [bx+DRVPARAMS.wHeadsAndSectors] ; Or .dwMaximumLBA+2
     117
    109118    push    es
    110119    pop     ds      ; DS:SI now points to ATA information
    111 
    112     ; Load User Defined CHS or LBA to CX:AX
    113     mov     dx, [cs:bx+DRVPARAMS.wFlags]
    114     mov     ax, [cs:bx+DRVPARAMS.wCylinders]        ; Or .dwMaximumLBA
    115     mov     cx, [cs:bx+DRVPARAMS.wHeadsAndSectors]  ; Or .dwMaximumLBA+2
    116120
    117121    ; * User defined CHS *
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm

    r567 r568  
    7272%endif
    7373
    74     mov     al,[cs:ROMVARS.wFlags]          ; Configurator set to always scan?
    75     or      al,[es:BDA.bKBFlgs1]            ; Or, did the user hold down the ALT key?
    76     and     al,8                            ; 8 = alt key depressed, same as FLG_ROMVARS_SERIAL_ALWAYSDETECT
     74    mov     al, [cs:ROMVARS.wFlags]         ; Configurator set to always scan?
     75    or      al, [es:BDA.bKBFlgs1]           ; Or, did the user hold down the ALT key?
     76    and     al, 8                           ; 8 = alt key depressed, same as FLG_ROMVARS_SERIAL_ALWAYSDETECT
    7777    jnz     .DriveDetectLoop
    7878%endif
     
    8989;
    9090    mov     cx, [RAMVARS.wDrvCntAndFlopCnt]     ; Our count of hard disks
    91 
    9291    mov     al, [es:BDA.bHDCount]
    93     add     cl, al                      ; Add our drives to the system count
    94     mov     [es:BDA.bHDCount], cl
     92    add     [es:BDA.bHDCount], cl       ; Add our drives to the system count
    9593    or      al, 80h                     ; Or in hard disk flag
    9694    mov     [RAMVARS.bFirstDrv], al     ; Store first drive number
     
    118116    inc     ax                              ; low order bit, indicating floppy drive exists
    119117
    120     mov     ah, [es:BDA.wEquipment]         ; Load Equipment WORD low byte
    121     and     ah, 03eh                        ; Mask off drive number and drives present bit
     118    mov     ah, 3Eh                         ; AND mask to AH (all bits set except floppy drive count/present)
     119    and     ah, [es:BDA.wEquipment]         ; Load Equipment WORD low byte and mask off drive number and drives present bit
    122120    or      al, ah                          ; Or in new values
    123121    mov     [es:BDA.wEquipment], al         ; and store
    124122
    125     mov     al, 1eh                         ; BDA pointer to Floppy DPT
     123    mov     al, 1Eh                         ; BDA pointer to Floppy DPT
    126124    mov     si, AH8h_FloppyDPT
    127125    call    Interrupts_InstallHandlerToVectorInALFromCSSI
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm

    r567 r568  
    181181    push    ax
    182182    push    di                          ; BIOS segment
    183     add     al, ROMVARS.szVersion - ROMVARS.szTitle
     183    mov     al, ROMVARS.szVersion & 0FFh
    184184    push    ax
    185185%else
  • trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuPrintCfg.asm

    r550 r568  
    5656;--------------------------------------------------------------------
    5757.PushAddressingMode:
    58     ACCESSDPT__GET_UNSHIFTED_TRANSLATE_MODE_TO_AXZF
     58    mov     al, [di+DPT.bFlagsLow]
     59    and     ax, BYTE MASKL_DPT_TRANSLATEMODE
    5960    ;;
    6061    ;; This multiply both shifts the addressing mode bits down to low order bits, and
     
    107108    eCMOVZ  ah, [di+DPT_ATA.bDevice]    ; DPT_ATA contains up to date device information for IDE drives
    108109%ifdef USE_UNDOC_INTEL
    109     eSALC   ; Clear AL using CF (from TEST above)
     110    salc    ; Clear AL using CF (from TEST above)
    110111    eAAD    g_szDeviceTypeValues_Displacement
    111112%else
  • trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm

    r567 r568  
    6969.PrintFloppyDriveHotkeys:
    7070    call    FloppyDrive_GetCountToAX
    71     test    ax, ax      ; Any Floppy Drives?
    72     jz      SHORT .SkipFloppyDriveHotkeys
     71    xchg    cx, ax      ; Any Floppy Drives?
     72    jcxz    .SkipFloppyDriveHotkeys
    7373
    7474    mov     ax, (ANGLE_QUOTE_RIGHT << 8) | DEFAULT_FLOPPY_DRIVE_LETTER
  • trunk/XTIDE_Universal_BIOS/Src/StringsCompressed.asm

    r536 r568  
    491491
    492492StringsCompressed_TranslatesAndFormats:
    493         db     32  ; 0
    494         db     172  ; 1
    495         db     171  ; 2
    496         db     179  ; 3
    497         db     175  ; 4
    498         db     33  ; 5
    499         db     34  ; 6
    500         db     44  ; 7
    501         db     45  ; 8
    502         db     46  ; 9
    503         db     47  ; 10
    504         db     49  ; 11
    505         db     50  ; 12
    506         db     51  ; 13
    507         db     53  ; 14
    508         db     54  ; 15
    509         db     56  ; 16
    510         db     200  ; 17
    511         db     181  ; 18
    512         db     48  ; 19
    513         db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_2_I)    ; 20
    514         db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_u)    ; 21
    515         db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_5_u)    ; 22
    516         db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_x)    ; 23
    517         db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_5_x)    ; 24
    518         db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_nl)    ; 25
    519         db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_2_u)    ; 26
    520         db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_A)    ; 27
    521         db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_c)    ; 28
    522         db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_s)    ; 29
    523         db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_z)    ; 30
     493        db     32   ; 0
     494        db     172  ; 1
     495        db     171  ; 2
     496        db     179  ; 3
     497        db     175  ; 4
     498        db     33   ; 5
     499        db     34   ; 6
     500        db     44   ; 7
     501        db     45   ; 8
     502        db     46   ; 9
     503        db     47   ; 10
     504        db     49   ; 11
     505        db     50   ; 12
     506        db     51   ; 13
     507        db     53   ; 14
     508        db     54   ; 15
     509        db     56   ; 16
     510        db     200  ; 17
     511        db     181  ; 18
     512        db     48   ; 19
     513        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_2_I)  ; 20
     514        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_u)    ; 21
     515        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_5_u)  ; 22
     516        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_x)    ; 23
     517        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_5_x)  ; 24
     518        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_nl)   ; 25
     519        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_2_u)  ; 26
     520        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_A)    ; 27
     521        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_c)    ; 28
     522        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_s)    ; 29
     523        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_z)    ; 30
    524524
    525525%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
     
    560560
    561561;; translated usage stats
    562 ;; 33:1
    563 ;; 32:35
    564 ;; 181:1
    565 ;; 53:2
    566 ;; 48:2
    567 ;; 200:1
    568 ;; 46:3
    569 ;; 179:8
     562;; 54:1
     563;; 47:2
     564;; 175:1
     565;; 49:1
    570566;; 44:1
    571567;; 50:2
     568;; 200:1
     569;; 181:1
     570;; 172:2
     571;; 45:2
     572;; 56:8
     573;; 33:1
     574;; 53:2
     575;; 179:8
     576;; 171:2
    572577;; 51:3
    573 ;; 47:2
    574 ;; 172:2
    575578;; 34:3
    576 ;; 49:1
    577 ;; 56:8
    578 ;; 45:2
    579 ;; 175:1
    580 ;; 171:2
    581 ;; 54:1
     579;; 48:2
     580;; 46:3
     581;; 32:35
    582582;; total translated: 20
    583583
    584584;; format usage stats
     585;; nl:12
     586;; x:5
    585587;; A:4
     588;; 5-x:1
    586589;; 2-u:1
     590;; z:2
    587591;; 5-u:2
    588 ;; x:5
    589592;; s:14
    590 ;; 5-x:1
    591 ;; nl:12
    592593;; 2-I:1
    593594;; u:6
    594595;; c:13
    595 ;; z:2
    596596;; total format: 11
    597597
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm

    r567 r568  
    5858
    5959%ifdef USE_UNDOC_INTEL
    60     eSALC   ; Clears AL using CF while preserving flags
     60    salc    ; Clears AL using CF while preserving flags
    6161%endif
    6262
     
    163163;--------------------------------------------------------------------
    164164AccessDPT_GetIdevarsToCSBX:
    165     eMOVZX  bx, BYTE [di+DPT.bIdevarsOffset]
     165    eMOVZX  bx, [di+DPT.bIdevarsOffset]
    166166    ret
    167167
    168 
    169 ;--------------------------------------------------------------------
    170 ; ACCESSDPT__GET_UNSHIFTED_TRANSLATE_MODE_TO_AXZF
    171 ;   Parameters:
    172 ;       DS:DI:  Ptr to Disk Parameter Table
    173 ;   Returns:
    174 ;       AX:     Translate Mode (TRANSLATEMODE_NORMAL, TRANSLATEMODE_LARGE or TRANSLATEMODE_ASSISTED_LBA)
    175 ;               unshifted (still shifted where it is in bFlagsLow)
    176 ;       ZF:     Set based on value in AL
    177 ;   Corrupts registers:
    178 ;       Nothing
    179 ;--------------------------------------------------------------------
    180 ;
    181 ; Converted to a macro since only called in two places, and the call/ret overhead
    182 ; is not worth it for these two instructions (4 bytes total)
    183 ;
    184 %macro ACCESSDPT__GET_UNSHIFTED_TRANSLATE_MODE_TO_AXZF 0
    185     mov     al, [di+DPT.bFlagsLow]
    186     and     ax, BYTE MASKL_DPT_TRANSLATEMODE
    187 %endmacro
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AtaGeometry.asm

    r567 r568  
    142142; GetSectorCountToDXAXfromCHSinAXBLBH
    143143;   Parameters:
    144 ;       ES:SI:  Ptr to 512-byte ATA information read from the drive
    145144;       AX:     Number of cylinders (1...16383)
    146145;       BL:     Number of heads (1...255)
     
    328327    cmp     ax, cx
    329328    jbe     SHORT .NumberOfHeadsNowInCX
    330     eSHL_IM cl, 1                       ; Double number of heads
    331     jnz     SHORT .CompareNextValidNumberOfHeads    ; Reached 256 heads?
    332     dec     cl                          ;  If so, limit heads to 255
     329    eSHL_IM cx, 1                       ; Double number of heads
     330    jpo     SHORT .CompareNextValidNumberOfHeads    ; Reached 256 heads?
     331    dec     cx                          ;  If so, limit heads to 255
    333332.NumberOfHeadsNowInCX:
    334333    mov     bx, cx                      ; Number of heads are returned in BL
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CompatibleDPT.asm

    r558 r568  
    114114;--------------------------------------------------------------------
    115115FillTranslatedDPTtoESDIfromDPTinDSSI:
    116     xor     dx, dx                      ; Clear for checksum
     116    cwd                                 ; Clear for checksum
    117117    call    StoswThenAddALandAHtoDL     ; Bytes 0 and 1 (Logical number of cylinders)
    118118
    119     mov     al, BYTE [si+DPT.bLchsHeads]
     119    mov     al, [si+DPT.bLchsHeads]
    120120    mov     ah, TRANSLATED_DPT_SIGNATURE
    121121    call    StoswThenAddALandAHtoDL     ; Bytes 2 (Logical number of heads) and 3 (Axh signature to indicate Translated DPT)
    122122
    123     eMOVZX  ax, BYTE [si+DPT.bPchsSectorsPerTrack]
     123    eMOVZX  ax, [si+DPT.bPchsSectorsPerTrack]
    124124    call    StoswThenAddALandAHtoDL     ; Bytes 4 (Physical sectors per track) and 5 (Write Precompensation Cylinder low)
    125125
    126     mov     al, ah
    127     call    StoswThenAddALandAHtoDL     ; Bytes 6 (Write Precompensation Cylinder high) and 7
    128 
    129     xchg    ax, cx                      ; Device Control byte to AL
     126    mov     al, ah                      ; Zero AX
     127    stosw                               ; Bytes 6 (Write Precompensation Cylinder high) and 7
     128
     129    xchg    cx, ax                      ; Device Control byte to AL, zero to CX
    130130    mov     ah, [si+DPT.wPchsCylinders]
    131131    call    StoswThenAddALandAHtoDL     ; Bytes 8 (Drive Control Byte) and 9 (Physical number of cylinders low)
     
    135135    call    StoswThenAddALandAHtoDL     ; Bytes 10 (Physical number of cylinders high) and 11 (Physical number of heads)
    136136
    137     xor     ax, ax
    138     call    StoswThenAddALandAHtoDL     ; Bytes 12 and 13 (Landing Zone Cylinder)
     137    xchg    cx, ax                      ; Zero to AX
     138    stosw                               ; Bytes 12 and 13 (Landing Zone Cylinder)
    139139
    140140    mov     al, [si+DPT.bLchsSectorsPerTrack]
     
    158158;       DI:     Incremented by 2
    159159;   Corrupts registers:
    160 ;       Nothing
     160;       AH
    161161;--------------------------------------------------------------------
    162162StoswALandChecksumFromDL:
     
    182182FillStandardDPTtoESDIfromDPTinDSSI:
    183183    stosw               ; Bytes 0 and 1 (Physical number of cylinders)
    184     eMOVZX  ax, BYTE [si+DPT.bLchsHeads]
     184    eMOVZX  ax, [si+DPT.bLchsHeads]
    185185    stosw               ; Bytes 2 (Physical number of heads) and 3
     186%ifdef USE_UNDOC_INTEL
     187%ifdef USE_386
     188    xor     al, al      ; Zero AX and clear CF
     189%else
     190    salc                ; Zero AX (CF cleared by eMOVZX above)
     191%endif
     192%else
    186193    mov     al, ah      ; Zero AX
     194%endif
    187195    stosw               ; Bytes 4 and 5 (Write Precompensation Cylinder low)
    188196    stosw               ; Bytes 6 (Write Precompensation Cylinder high) and 7
    189197    mov     al, cl      ; Device control byte to AL
    190198    stosw               ; Bytes 8 (Drive Control Byte) and 9
     199%ifdef USE_UNDOC_INTEL
     200    salc                ; Zero AX (CF cleared above)
     201%else
    191202    mov     al, ah      ; Zero AX
     203%endif
    192204    stosw               ; Bytes 10 and 11
    193205    stosw               ; Bytes 12 and 13 (Landing Zone Cylinder)
     
    208220;       ES:BX:  Ptr to Device Parameter Table Extension (DPTE)
    209221;   Corrupts registers:
    210 ;       AX, CX, DX, DI
     222;       AX, CX, DL, DI
    211223;--------------------------------------------------------------------
    212224CompatibleDPT_CreateDeviceParameterTableExtensionToESBXfromDPTinDSSI:
    213     call    GetTemporaryBufferForDPTEtoESDI ; valid until next AH=48h call
     225    call    GetTemporaryBufferForDPTEtoESDI ; Valid until next AH=48h call
    214226
    215227    ; Set 32-bit flag for 32-bit controllers
     
    218230    eCMOVE  cl, FLG_LBA_TRANSLATION_ENABLED | FLG_32BIT_XFER_MODE
    219231
     232    xor     dl, dl                          ; Clear DL for checksum
     233
    220234    ; DPTE.wBasePort
    221235    mov     ax, [si+DPT.wBasePort]
     
    223237
    224238    ; DPTE.wControlBlockPort
    225     eMOVZX  bx, BYTE [si+DPT.bIdevarsOffset]
     239    eMOVZX  bx, [si+DPT.bIdevarsOffset]
    226240    mov     ax, [cs:bx+IDEVARS.wControlBlockPort]
    227241    call    StoswThenAddALandAHtoDL         ; Bytes 2 and 3
     
    244258    ; DPTE.bDmaChannelAndType and DPTE.bPioMode
    245259    xor     ax, ax
    246 %ifdef MODULE_ADVANCED_ATA
     260%ifndef MODULE_ADVANCED_ATA
     261    stosw                                   ; Bytes 8 and 9
     262%else
    247263    or      ah, [si+DPT_ADVANCED_ATA.bPioMode]
    248264    jz      SHORT .DoNotSetFastPioFlag
    249     cmp     WORD [si+DPT_ADVANCED_ATA.wControllerID], BYTE 0
    250     je      SHORT .DoNotSetFastPioFlag
    251     inc     cx      ; FLG_FAST_PIO_ENABLED
     265    cmp     WORD [si+DPT_ADVANCED_ATA.wControllerID], BYTE 1
     266    sbb     cl, -1  ; FLG_FAST_PIO_ENABLED (if .wControllerID > 0)
    252267.DoNotSetFastPioFlag:
    253 %endif
    254268    call    StoswThenAddALandAHtoDL         ; Bytes 8 and 9
     269%endif
    255270
    256271    ; Set CHS translation flags and store DPTE.wFlags
     
    261276    test    al, FLGL_DPT_ASSISTED_LBA
    262277    jz      SHORT .NoChsTranslationOrBitShiftTranslationSet
    263     or      cx, LBA_ASSISTED_TRANSLATION << TRANSLATION_TYPE_FIELD_POSITION
     278    or      ch, LBA_ASSISTED_TRANSLATION << (TRANSLATION_TYPE_FIELD_POSITION - 8)
    264279.NoChsTranslationOrBitShiftTranslationSet:
    265280    xchg    ax, cx
     
    268283    ; DPTE.wReserved (must be zero)
    269284    xor     ax, ax
    270     call    StoswThenAddALandAHtoDL         ; Bytes 12 and 13
     285    stosw                                   ; Bytes 12 and 13
    271286
    272287    ; DPTE.bRevision and DPTE.bChecksum
    273288    mov     al, DPTE_REVISION
    274     call    StoswALandChecksumFromDL        ; Bytes 14 and 15
    275     lea     bx, [di-DPTE_size]
    276     ret
     289    lea     bx, [di+2-DPTE_size]            ; The +2 compensates for the last WORD yet to be stored
     290    jmp     StoswALandChecksumFromDL        ; Bytes 14 and 15
    277291%endif ; MODULE_EBIOS
    278292
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm

    r567 r568  
    116116    jnz     SHORT .NothingToChange
    117117
    118 .LimitHeadsForLargeAddressingMode:
    119118    ; We cannot have 16 P-Heads heads in Revised ECHS mode (8193 or more cylinders)
    120119    ; but 16 heads are allowed when there are 8192 or less cylinders (ECHS).
    121120    ; Both of these are LARGE modes so do not confuse with NORMAL mode.
    122121    call    AtaGeometry_IsDriveSmallEnoughForECHS
    123     jc      SHORT .NothingToChange
    124     dec     bx                      ; Adjust 16 P-Heads to 15
     122    adc     bx, -1                  ; Adjust 16 P-Heads to 15 if needed
    125123
    126124.NothingToChange:
Note: See TracChangeset for help on using the changeset viewer.