Changeset 589 in xtideuniversalbios


Ignore:
Timestamp:
May 22, 2016, 12:26:57 PM (8 years ago)
Author:
krille_n_
Message:

Changes:

  • BIOS: Fixed a purely cosmetic bug from r542 where, in builds containing MODULE_EBIOS, the boot menu would display an incorrect drive size (0.4 kB with MODULE_STRINGS_COMPRESSED or 0.5 kB without) for old drives with no support for LBA.
  • Fixed a bug from r392 where Vision_DetectAndReturnIDinAXandPortInDXifControllerPresent would return the ID in AL instead of AH (if DANGEROUS_DETECTION had been defined).
  • Fixed a bug from r587 in AdvAtaInit.asm that would prevent detection of QDI Vision controllers.
  • Also changed how the QDI Vision IDs are defined (removed the need for shifting) to avoid confusion. This fixed a potential bug from r587 in AdvAtaInit.asm where some IDs were not being shifted.
  • Fixed a bug in PDC20x30.asm from r587 where GetPdcIDtoAX would not return with the IDE base port in DX so DisablePdcProgrammingMode would fail.
  • Made some changes to ModuleDependency.inc and other files so that MODULE_ADVANCED_ATA now requires USE_386. Consequently it is no longer included in the regular AT-builds, only in the 386_8k-build.
  • Moved the UNROLL_SECTORS_IN_CX_TO_xWORDS macros from IDE_8bit.inc to IdeIO.inc which means it's now possible to build a BIOS without MODULE_8BIT_IDE.
  • XTIDECFG: Added a minimum DOS version check (since it needs DOS version 2+) to allow the program to quit gracefully in the unlikely scenario where someone tries to run it under DOS version 1.
  • Made some changes to Drive.asm to improve drive enumeration. The old method using GET_DOS_DRIVE_PARAMETER_BLOCK_FOR_SPECIFIC_DRIVE worked well in Windows XP but not in Windows 98 SE (in Windows or in DOS mode). The two problems were; 1) The function call would access the drives which on single floppy drive systems would cause Windows to swap between A: and B: (throwing a blue screen asking the user to insert a disk etc). 2) Only floppy drives and FAT16 drives would be available in the list of drives, no FAT32/optical/network drives.
  • Improved code in IdeControllerMenu.asm so that the default port addresses for all IDE interfaces are now restored when (re-)selecting the (same) type of IDE device.
  • Also made it impossible to select a device type unless the required module is included in the loaded BIOS.
  • The version check done when loading a BIOS now uses the FLASH_SIGNATURE definition from Version.inc. Any changes affecting RomVars now only requires updating that definition. This means that changes to RomVars must be implemented in both the BIOS and XTIDECFG before being committed to the repository.
  • Added a compatibility fix for 3Com 3C503 cards to the ROM checksumming code in Buffers.asm (Buffers_GenerateChecksum).
  • SerDrive: Made some minor changes to file names and paths to improve compatibility with case sensitive environments.
  • BIOSDRVS: Made a minor size optimization which as a side effect also makes it compatible with all DOS versions including DOS version 1.
  • Library: Renamed the WAIT_RETRACE_IF_NECESSARY_THEN macro to CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN and made a tail-call-optimized version of it (JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN).
  • A speed optimization to the eRCL_IM macro for 386 and higher. This change breaks emulation in the sense that the macro will fail when given a memory operand as the first parameter.
  • Other minor optimizations and fixes.
Location:
trunk
Files:
74 edited

Legend:

Unmodified
Added
Removed
  • trunk/Assembly_Library/Inc/CgaSnow.inc

    r52 r589  
    1 ; File name     :   CgaSnow.inc
    2 ; Project name  :   AssemblyLibrary
    3 ; Created date  :   8.10.2010
    4 ; Last update   :   11.10.2010
    5 ; Author        :   Tomi Tilli
     1; Project name  :   Assembly Library
    62; Description   :   Macros for preventing CGA snow.
    73%ifndef CGASNOW_INC
     
    95
    106;--------------------------------------------------------------------
    11 ; WAIT_RETRACE_IF_NECESSARY_THEN
     7; CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN
     8; JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN
    129;   Parameters:
    1310;       %1:     Instruction that accessed CGA memory
     
    2219;       AX, DX
    2320;--------------------------------------------------------------------
    24 %macro WAIT_RETRACE_IF_NECESSARY_THEN 1
     21%macro CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN 1
    2522%ifdef ELIMINATE_CGA_SNOW
    2623    %ifidn %1, stosb
     
    3128        call    CgaSnow_RepMovsb
    3229    %else
    33         %error  "Invalid instruction passed to WAIT_RETRACE_IF_NECESSARY_THEN"
     30        %error  "Invalid instruction passed to CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN"
    3431    %endif
    3532%else   ; No CGA snow prevention
     
    3835    %else
    3936        %1  ; Single instruction
     37    %endif
     38%endif
     39%endmacro
     40
     41%macro JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN 1
     42%ifdef ELIMINATE_CGA_SNOW
     43    %ifidn %1, stosb
     44        jmp     CgaSnow_Stosb
     45    %elifidn %1, stosw
     46        jmp     CgaSnow_Stosw
     47    %elifidn %1, rep movsb
     48        jmp     CgaSnow_RepMovsb
     49    %else
     50        %error  "Invalid instruction passed to JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN"
     51    %endif
     52%else   ; No CGA snow prevention
     53    %ifidn %1, rep movsb
     54        eSEG_STR rep, es, movsb
     55        ret
     56    %else
     57        %1  ; Single instruction
     58        ret
    4059    %endif
    4160%endif
  • trunk/Assembly_Library/Inc/DosFunctions.inc

    r446 r589  
    99DOS_TSR_MULTIPLEX_INTERRUPT_2Fh                     EQU     2Fh
    1010
    11 ; DOS drive and file functions
    12 SELECT_DEFAULT_DRIVE                                EQU     0Eh
    13 GET_CURRENT_DEFAULT_DRIVE                           EQU     19h
    14 GET_DISK_TRANSFER_AREA_ADDRESS                      EQU     2Fh
    15 GET_DOS_DRIVE_PARAMETER_BLOCK_FOR_SPECIFIC_DRIVE    EQU     32h
    16 SET_CURRENT_DIRECTORY                               EQU     3Bh
    17 CREATE_OR_TRUNCATE_FILE                             EQU     3Ch
    18 OPEN_EXISTING_FILE                                  EQU     3Dh
    19 CLOSE_FILE                                          EQU     3Eh
    20 READ_FROM_FILE_OR_DEVICE                            EQU     3Fh
    21 WRITE_TO_FILE_OR_DEVICE                             EQU     40h
    22 SET_CURRENT_FILE_POSITION                           EQU     42h
    23 GET_CURRENT_DIRECTORY                               EQU     47h
    24 FIND_FIRST_MATCHING_FILE                            EQU     4Eh
    25 FIND_NEXT_MATCHING_FILE                             EQU     4Fh
    26 
    27 ; DOS functions for TSRs
    28 SET_INTERRUPT_VECTOR                                EQU     25h
    29 GET_INTERRUPT_VECTOR                                EQU     35h
     11; DOS functions
     12WRITE_CHARACTER_TO_STANDARD_OUTPUT                  EQU     02h     ; DOS 1+
     13WRITE_STRING_TO_STANDARD_OUTPUT                     EQU     09h     ; DOS 1+
     14SELECT_DEFAULT_DRIVE                                EQU     0Eh     ; DOS 1+
     15GET_CURRENT_DEFAULT_DRIVE                           EQU     19h     ; DOS 1+
     16SET_INTERRUPT_VECTOR                                EQU     25h     ; DOS 1+
     17GET_DISK_TRANSFER_AREA_ADDRESS                      EQU     2Fh     ; DOS 2+
     18GET_DOS_VERSION                                     EQU     30h     ; DOS 2+
     19GET_DOS_DRIVE_PARAMETER_BLOCK_FOR_SPECIFIC_DRIVE    EQU     32h     ; DOS 2+
     20GET_INTERRUPT_VECTOR                                EQU     35h     ; DOS 2+
     21SET_CURRENT_DIRECTORY                               EQU     3Bh     ; DOS 2+
     22CREATE_OR_TRUNCATE_FILE                             EQU     3Ch     ; DOS 2+
     23OPEN_EXISTING_FILE                                  EQU     3Dh     ; DOS 2+
     24CLOSE_FILE                                          EQU     3Eh     ; DOS 2+
     25READ_FROM_FILE_OR_DEVICE                            EQU     3Fh     ; DOS 2+
     26WRITE_TO_FILE_OR_DEVICE                             EQU     40h     ; DOS 2+
     27SET_CURRENT_FILE_POSITION                           EQU     42h     ; DOS 2+
     28CHECK_IF_BLOCK_DEVICE_REMOTE                        EQU     4409h   ; DOS 3.1+
     29GET_CURRENT_DIRECTORY                               EQU     47h     ; DOS 2+
     30TERMINATE_WITH_RETURN_CODE                          EQU     4Ch     ; DOS 2+
     31FIND_FIRST_MATCHING_FILE                            EQU     4Eh     ; DOS 2+
     32FIND_NEXT_MATCHING_FILE                             EQU     4Fh     ; DOS 2+
    3033
    3134; DOS errors
     35ERR_DOS_FUNCTION_NUMBER_INVALID                     EQU     01h
     36ERR_DOS_INVALID_DRIVE                               EQU     0Fh
    3237ERR_DOS_DRIVE_NOT_READY                             EQU     15h
    33 
    3438
    3539
  • trunk/Assembly_Library/Inc/Emulate.inc

    r586 r589  
    579579
    580580%macro eRCL_IM 2
     581%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
     582%ifdef USE_386
     583    %if %2 = 1
     584        adc     %1, %1  ; Same size but faster on 386 and 486. Fails if %1 is a memory operand.
     585    %else
     586        eSHIFT_IM   %1, %2, rcl
     587    %endif
     588%else
    581589    eSHIFT_IM   %1, %2, rcl
     590%endif
     591%endif
    582592%endmacro
    583593
  • trunk/Assembly_Library/Inc/Math.inc

    r445 r589  
    8080.ShiftNextBit:
    8181    eSHL_IM ax, 1
    82     rcl     dx, 1
     82    eRCL_IM dx, 1
    8383    loop    .ShiftNextBit
    8484%endmacro
  • trunk/Assembly_Library/Inc/SystemTimer.inc

    r287 r589  
    11; Project name  :   Assembly Library
    2 ; Description   :   System Timer (8254) relates equates and macros.
     2; Description   :   System Timer (8254) related equates and macros.
    33%ifndef SYSTEMTIMER_INC
    44%define SYSTEMTIMER_INC
     
    3434CONTROL_WORD_REGISTER_out               EQU 43h
    3535
    36 ; Timer 2 is connected to PC Speaker that can be controller from port 61h.
     36; Timer 2 is connected to PC Speaker that can be controlled from port 61h.
    3737SPEAKER_CONTROL_REGISTER                EQU 61h
    3838FLG_TIMER_2_OUTPUT_in                   EQU (1<<5)  ; AT+ only
  • trunk/Assembly_Library/Src/Display/DisplayCharOut.asm

    r526 r589  
    4141    cmp     al, ' '                         ; Printable character?
    4242    jb      SHORT DisplayCharOut_BiosTeletypeOutput
    43     WAIT_RETRACE_IF_NECESSARY_THEN stosw
    44     ret
     43    JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN stosw
    4544
    4645ALIGN DISPLAY_JUMP_ALIGN
     
    9695    xchg    al, ah              ; Swap character and attribute
    9796    inc     di                  ; Skip character
    98     WAIT_RETRACE_IF_NECESSARY_THEN stosb
    99     ret
     97    JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN stosb
    10098
    10199ALIGN DISPLAY_JUMP_ALIGN
    102100DisplayCharOut_Character:
    103     WAIT_RETRACE_IF_NECESSARY_THEN stosb
     101    CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN stosb
    104102    inc     di                  ; Skip attribute
    105103    ret
     
    107105ALIGN DISPLAY_JUMP_ALIGN
    108106DisplayCharOut_CharacterWithAttribute:
    109     WAIT_RETRACE_IF_NECESSARY_THEN stosw
    110     ret
     107    JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN stosw
    111108
    112109
  • trunk/Assembly_Library/Src/Display/DisplayFormat.asm

    r526 r589  
    269269    jz      SHORT .CopyWithoutDisplayProcessing
    270270
    271     WAIT_RETRACE_IF_NECESSARY_THEN rep movsb
     271    CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN rep movsb
    272272    dec     di                  ; Point to preceeding character instead of attribute
    273273    ret
     274
    274275ALIGN DISPLAY_JUMP_ALIGN
    275276.CopyWithoutDisplayProcessing:
  • trunk/Assembly_Library/Src/Display/DisplayPage.asm

    r526 r589  
    4343%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
    4444    %define EXCLUDE
    45     %ifdef MODULE_HOTKEYS
    46         %undef EXCLUDE
    47     %endif
    48     %ifdef MODULE_BOOT_MENU
     45    %ifdef MODULE_HOTKEYS OR MODULE_BOOT_MENU
    4946        %undef EXCLUDE
    5047    %endif
  • trunk/Assembly_Library/Src/Display/DisplayPrint.asm

    r580 r589  
    296296        %undef EXCLUDE
    297297    %endif
    298     %ifdef MODULE_HOTKEYS
    299         %undef EXCLUDE
    300     %endif
    301     %ifdef MODULE_BOOT_MENU
     298    %ifdef MODULE_HOTKEYS OR MODULE_BOOT_MENU
    302299        %undef EXCLUDE
    303300    %endif
  • trunk/Assembly_Library/Src/File/Drive.asm

    r526 r589  
    8686    xchg    dx, ax          ; Default drive to DL
    8787    call    Drive_SetDefaultFromDL
    88     eMOVZX  cx, al          ; Number of potentially valid drive letters available
    89     cmp     cl, 32
    90     jb      SHORT .Return
    91     mov     cl, 32
    92 ALIGN JUMP_ALIGN, ret
    93 .Return:
     88    cmp     al, 32          ; Number of potentially valid drive letters available
     89    jb      SHORT .Below32
     90    mov     al, 32
     91.Below32:
     92    cbw
     93    xchg    cx, ax
    9494    ret
    9595
     
    133133
    134134    inc     dx          ; Default drive is 00h and first drive is 01h
     135    mov     ax, CHECK_IF_BLOCK_DEVICE_REMOTE    ; Needs DOS 3.1+
     136    mov     bx, dx
     137    push    dx
     138    int     DOS_INTERRUPT_21h
     139    pop     dx
     140    jnc     SHORT .DriveIsValid
     141    cmp     ax, ERR_DOS_INVALID_DRIVE
     142    je      SHORT .DriveIsNotValid
     143    ; Fall back to old method if ERR_DOS_FUNCTION_NUMBER_INVALID
     144
    135145    mov     ah, GET_DOS_DRIVE_PARAMETER_BLOCK_FOR_SPECIFIC_DRIVE
    136146    int     DOS_INTERRUPT_21h
     147.DriveIsValid:
     148.DriveIsNotValid:
    137149    dec     dx
    138150    test    al, al
  • trunk/Assembly_Library/Src/Keyboard/Keyboard.asm

    r581 r589  
    291291%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
    292292    %define EXCLUDE
    293     %ifdef MODULE_HOTKEYS
    294         %undef EXCLUDE
    295     %endif
    296     %ifdef MODULE_BOOT_MENU
     293    %ifdef MODULE_HOTKEYS OR MODULE_BOOT_MENU
    297294        %undef EXCLUDE
    298295    %endif
  • trunk/Assembly_Library/Src/Menu/CharOutLineSplitter.asm

    r526 r589  
    162162    push    si
    163163    push    cx
    164     WAIT_RETRACE_IF_NECESSARY_THEN rep movsb
     164    CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN rep movsb
    165165    pop     cx
    166166    pop     si
  • trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm

    r568 r589  
    239239; AppendFileFromDTAinDSSItoOffScreenBuffer
    240240;   Parameters:
    241 ;       CX:     Files/directores found
     241;       CX:     Files/directories found
    242242;       DL:     Zero if root directory selected
    243243;       DS:SI:  Ptr to DTA containing file information
  • trunk/Assembly_Library/Src/Menu/MenuLoop.asm

    r581 r589  
    106106%ifndef MENU_NO_ESC
    107107    cmp     al, ESC
    108     je      SHORT .LeaveMenuWithoutSelectingItem
    109 %endif
    110     cmp     al, CR
    111     je      SHORT .SelectItem
    112 
    113     test    BYTE [bp+MENU.bFlags], FLG_MENU_USER_HANDLES_SCROLLING
    114     jz      SHORT MenuLoop_ProcessScrollingKeysFromAX
    115     ret     ; Return with CF cleared since keystroke not processed
    116 
    117 %ifndef MENU_NO_ESC
    118 ALIGN MENU_JUMP_ALIGN
    119 .LeaveMenuWithoutSelectingItem:
     108    jne     SHORT .NotEscape
     109
     110    ; Leave menu without selecting item
    120111    call    MenuEvent_ExitMenu
    121112    jnc     SHORT .CancelMenuExit
     
    128119
    129120ALIGN MENU_JUMP_ALIGN
    130 .SelectItem:
     121.NotEscape:
     122    cmp     al, CR
     123    jne     SHORT .NotCarriageReturn
     124
     125    ; Select item
    131126    mov     cx, [bp+MENUINIT.wHighlightedItem]
    132127    call    MenuEvent_ItemSelectedFromCX
    133128    stc
    134     ret
     129.Return:
     130    ret
     131
     132ALIGN MENU_JUMP_ALIGN
     133.NotCarriageReturn:
     134    test    BYTE [bp+MENU.bFlags], FLG_MENU_USER_HANDLES_SCROLLING
     135    jnz     SHORT .Return   ; With CF cleared since keystroke not processed
     136    ; Fall to MenuLoop_ProcessScrollingKeysFromAX
    135137
    136138
     
    172174.ChangeToPreviousPage:
    173175    call    MenuScrollbars_GetMaxVisibleItemsOnPageToCX
    174     xchg    ax, cx
    175     neg     ax
    176     mov     cx, [bp+MENUINIT.wHighlightedItem]
    177     add     cx, ax
     176    neg     cx
     177    mov     ax, cx
     178    add     cx, [bp+MENUINIT.wHighlightedItem]
    178179    jge     SHORT .MoveHighlightedItemByAX  ; No rotation for PgUp
    179180    ; Fall to .SelectFirstItem
     
    187188.ChangeToNextPage:
    188189    call    MenuScrollbars_GetMaxVisibleItemsOnPageToCX
    189     xchg    ax, cx
    190     mov     cx, [bp+MENUINIT.wHighlightedItem]
    191     add     cx, ax
     190    mov     ax, cx
     191    add     cx, [bp+MENUINIT.wHighlightedItem]
    192192    cmp     cx, [bp+MENUINIT.wItems]
    193193    jb      SHORT .MoveHighlightedItemByAX  ; No rotation for PgDn
  • trunk/Assembly_Library/Src/Serial/SerialServerScan.asm

    r567 r589  
    4646
    4747        test    dx, dx
    48         jnz     short SerialServerScan_CheckForServer_PortAndBaudInDX
     48        jnz     SHORT SerialServerScan_CheckForServer_PortAndBaudInDX
    4949
    50         mov     di,.scanPortAddresses-1
    51         mov     ch,1            ;  tell server that we are scanning
     50        mov     di, .scanPortAddresses-1
     51        mov     ch, 1           ;  tell server that we are scanning
    5252
    5353.nextPort:
    5454        inc     di              ; load next port address
    55         xor     dh, dh
    56         mov     dl,[cs:di]
     55        mov     dh, 40h         ; Clear DH and make sure CF is set if error
     56        mov     dl, [cs:di]
    5757        eSHL_IM dx, 2           ; shift from one byte to two
    58         stc                     ; setup error code for exit
    59         jz      .error
     58        jz      SHORT .error
    6059
    6160;
     
    6362;
    6463        push    dx
    65         add     dl,Serial_UART_lineControl
    66         mov     al, 09ah
     64        add     dl, Serial_UART_lineControl
     65        mov     al, 9Ah
    6766        out     dx, al
    6867        in      al, dx
    6968        pop     dx
    70         cmp     al, 09ah
    71         jnz     .nextPort
     69        cmp     al, 9Ah
     70        jne     SHORT .nextPort
    7271
    73         mov     al, 0ch
     72        mov     al, 0Ch
    7473        out     dx, al
    7574        in      al, dx
    76         cmp     al, 0ch
    77         jnz     .nextPort
     75        cmp     al, 0Ch
     76        jne     SHORT .nextPort
    7877
    7978;
     
    8483; *on the server side* if the client side had a 4x clock multiplier, a 2x clock multiplier, or no clock multiplier.
    8584;
    86 ; Starting with 30h, that means 30h (2400 baud), 18h (4800 baud), 0ch (9600 baud), and
     85; Starting with 30h, that means 30h (2400 baud), 18h (4800 baud), 0Ch (9600 baud), and
    8786;                               04h (28800 baud), 02h (57600 baud), 01h (115200 baud)
    8887;
    89 ; Note: hardware baud multipliers (2x, 4x) will impact the final baud rate and are not known at this level
     88; Note: hardware baud multipliers (2x, 4x, 8x) will impact the final baud rate and are not known at this level
    9089;
    91         mov     dh,030h * 2     ; multiply by 2 since we are about to divide by 2
    92         mov     dl,[cs:di]      ; restore single byte port address for scan
     90        mov     dh, 30h * 2     ; multiply by 2 since we are about to divide by 2
     91        mov     dl, [cs:di]     ; restore single byte port address for scan
    9392
    9493.nextBaud:
    95         shr     dh,1
    96         jz      .nextPort
    97         cmp     dh,6            ; skip from 6 to 4, to move from the top of the 9600 baud range
    98         jnz     .testBaud       ; to the bottom of the 115200 baud range
    99         mov     dh,4
     94        shr     dh, 1
     95        jz      SHORT .nextPort
     96        cmp     dh, 6           ; skip from 6 to 4, to move from the top of the 9600 baud range
     97        jne     SHORT .testBaud ; to the bottom of the 115200 baud range
     98        mov     dh, 4
    10099
    101100.testBaud:
    102101        call    SerialServerScan_CheckForServer_PortAndBaudInDX
    103         jc      .nextBaud
     102        jc      SHORT .nextBaud
    104103
    105104.error:
     
    135134SerialServerScan_CheckForServer_PortAndBaudInDX:
    136135        push    bp              ; setup fake SerialServer_Command
    137 
    138136        push    dx              ; send port baud and rate, returned in inquire packet
    139137                                ; (and possibly returned in the drive identification string)
    140 
    141138        push    cx              ; send number of sectors, and if it is on a scan or not
    142 
    143         mov     bl,SerialServer_Command_Inquire         ; protocol command onto stack with bh
     139        mov     bl, SerialServer_Command_Inquire        ; protocol command onto stack with bh
    144140        push    bx
    145141
    146         mov     bp,sp
    147 
     142        mov     bp, sp
    148143        call    SerialServer_SendReceive
    149144
  • trunk/Assembly_Library/Src/Util/Math.asm

    r526 r589  
    3636ALIGN JUMP_ALIGN
    3737Math_DivQWatSSBPbyCX:
     38%if 1
    3839    xor     dx, dx
    3940    mov     ax, [bp+6]      ; Load highest divident WORD to DX:AX
     
    5354    mov     [bp], ax
    5455    ret
     56%else ; ~1
     57; This is about half the size compared to the above code but it's not tested which is why it's commented away.
     58    push    di
     59    mov     di, 6
     60    xor     dx, dx
     61.Next:
     62    mov     ax, [bp+di]
     63    div     cx
     64    mov     [bp+di], ax
     65    dec     di
     66    dec     di
     67    jns     .Next
     68    pop     di
     69    ret
     70%endif ; 1
    5571%endif
    5672
  • trunk/BIOS_Drive_Information_Tool/Src/Bios.asm

    r566 r589  
    146146    mov     bx, 55AAh
    147147    int     BIOS_DISK_INTERRUPT_13h
    148     jc      SHORT .NoEbiosPresent
    149     cmp     bx, 0AA55h
    150     jne     SHORT .NoEbiosPresent
    151     eMOVZX  bx, ah          ; Copy version to BX
    152     xor     ah, ah
    153     ret
    154 .NoEbiosPresent:
    155     mov     ah, RET_HD_INVALID
    156     stc
     148    jc      SHORT ReturnInvalidErrorCodeInAH    ; No EBIOS present
     149    xor     bx, 0AA55h
     150    jnz     SHORT ReturnInvalidErrorCodeInAH    ; No EBIOS present
     151    xchg    bl, ah          ; Version to BX, BIOS error code to AH
    157152    ret
    158153
  • trunk/BIOS_Drive_Information_Tool/Src/Main.asm

    r558 r589  
    6060    mov     si, g_szProgramName
    6161    call    Print_NullTerminatedStringFromSI
    62 
    63     call    ReadAndDisplayAllHardDrives
    64 
    65     ; Exit to DOS
    66     mov     ax, 4C00h           ; Exit to DOS
    67     int     21h
     62    ; Fall to ReadAndDisplayAllHardDrives
    6863
    6964
     
    112107    loop    .DisplayNextDriveFromDL
    113108.NoDrivesAvailable:
    114     ret
     109    ret     ; Exit to DOS
    115110
    116111
  • trunk/BIOS_Drive_Information_Tool/Src/Print.asm

    r567 r589  
    4242;   Parameters:
    4343;       AL:     Character to output
    44 ;       DS:     BDA segment (zero)
    45 ;       ES:DI:  Ptr to video memory where to output
    46 ;   Returns:
    47 ;       DI:     Incremented for next character
     44;   Returns:
     45;       Nothing
    4846;   Corrupts registers:
    4947;       AX, DX
     
    5149DosCharOut:
    5250    xchg    dx, ax
    53     mov     ah, 02h     ; DOS 1+ - WRITE CHARACTER TO STANDARD OUTPUT
    54     int     21h         ; Call DOS
     51    mov     ah, WRITE_CHARACTER_TO_STANDARD_OUTPUT
     52    int     DOS_INTERRUPT_21h
    5553    ret
    5654
  • trunk/Serial_Server/library/Checksum.cpp

    r526 r589  
    33// Project:     XTIDE Universal BIOS, Serial Port Server
    44//
    5 // File:        checksum.cpp - Checksum function and test routines
     5// File:        Checksum.cpp - Checksum function and test routines
    66
    77//
     
    3939//
    4040
    41 #include "library.h"
     41#include "Library.h"
    4242
    4343unsigned short checksum( unsigned short *wbuff, int wlen )
  • trunk/Serial_Server/library/File.h

    r526 r589  
    33// Project:     XTIDE Universal BIOS, Serial Port Server
    44//
    5 // File:        file.h - File access via standard "stdio.h" routines
     5// File:        File.h - File access via standard "stdio.h" routines
    66//
    77// Routines for accessing the file system using generic routines, which
  • trunk/Serial_Server/library/FlatImage.h

    r526 r589  
    2222//
    2323
    24 #include "library.h"
     24#include "Library.h"
    2525
    2626class FlatImage : public Image
  • trunk/Serial_Server/library/Image.cpp

    r526 r589  
    33// Project:     XTIDE Universal BIOS, Serial Port Server
    44//
    5 // File:        image.cpp - Abstract base class for disk image support
     5// File:        Image.cpp - Abstract base class for disk image support
    66//
    77
     
    2222//
    2323
    24 #include "library.h"
     24#include "Library.h"
    2525#include <memory.h>
    2626#include <stdlib.h>
  • trunk/Serial_Server/library/Library.h

    r526 r589  
    33// Project:     XTIDE Universal BIOS, Serial Port Server
    44//
    5 // File:        library.h - Include file for users of the library
     5// File:        Library.h - Include file for users of the library
    66//
    77
     
    8787
    8888#ifdef WIN32
    89 #include "../win32/win32serial.h"
     89#include "../win32/Win32Serial.h"
    9090#else
    9191// there is no standard way to read/write and configure the serial port, OS specific only
     
    9393
    9494#ifdef WIN32
    95 #include "../win32/win32file.h"
     95#include "../win32/Win32File.h"
    9696#else
    97 #include "file.h"
     97#include "File.h"
    9898#endif
    9999
  • trunk/Serial_Server/library/Process.cpp

    r526 r589  
    33// Project:     XTIDE Universal BIOS, Serial Port Server
    44//
    5 // File:        process.cpp - Processes commands received over the serial port
     5// File:        Process.cpp - Processes commands received over the serial port
    66//
    77
     
    2222//
    2323
    24 #include "library.h"
     24#include "Library.h"
    2525#include <memory.h>
    2626#include <string.h>
  • trunk/Serial_Server/library/Serial.cpp

    r526 r589  
    2222//
    2323
    24 #include "library.h"
     24#include "Library.h"
    2525#include <stdlib.h>
    2626#include <string.h>
  • trunk/Serial_Server/makefile

    r344 r589  
    1111#
    1212
    13 HEADERS = library/library.h win32/win32file.h win32/win32serial.h library/file.h library/flatimage.h
     13HEADERS = library/Library.h win32/Win32File.h win32/Win32Serial.h library/File.h library/FlatImage.h
    1414
    1515CXX = cl
     
    2121    @$(CXX) /Febuild/serdrive.exe $(WIN32OBJS)
    2222
    23 build/win32.obj:    win32/win32.cpp $(HEADERS)
    24     @$(CXX) /c $(CXXFLAGS) win32/win32.cpp /Fobuild/win32.obj
     23build/win32.obj:    win32/Win32.cpp $(HEADERS)
     24    @$(CXX) /c $(CXXFLAGS) win32/Win32.cpp /Fobuild/win32.obj
    2525
    26 build/checksum.obj: library/checksum.cpp $(HEADERS)
    27     @$(CXX) /c $(CXXFLAGS) library/checksum.cpp /Fobuild/checksum.obj
     26build/checksum.obj: library/Checksum.cpp $(HEADERS)
     27    @$(CXX) /c $(CXXFLAGS) library/Checksum.cpp /Fobuild/checksum.obj
    2828
    29 build/serial.obj:   library/serial.cpp $(HEADERS)
    30     @$(CXX) /c $(CXXFLAGS) library/serial.cpp /Fobuild/serial.obj
     29build/serial.obj:   library/Serial.cpp $(HEADERS)
     30    @$(CXX) /c $(CXXFLAGS) library/Serial.cpp /Fobuild/serial.obj
    3131
    32 build/process.obj:  library/process.cpp $(HEADERS)
    33     @$(CXX) /c $(CXXFLAGS) library/process.cpp /Fobuild/process.obj
     32build/process.obj:  library/Process.cpp $(HEADERS)
     33    @$(CXX) /c $(CXXFLAGS) library/Process.cpp /Fobuild/process.obj
    3434
    35 build/image.obj:    library/image.cpp $(HEADERS)
    36     @$(CXX) /c $(CXXFLAGS) library/image.cpp /Fobuild/image.obj
     35build/image.obj:    library/Image.cpp $(HEADERS)
     36    @$(CXX) /c $(CXXFLAGS) library/Image.cpp /Fobuild/image.obj
    3737
    3838
     
    4646
    4747
    48 build/checksum_test.exe:    library/checksum.cpp
    49     @$(CXX) /Febuild/checksum_test.exe /Ox library/checksum.cpp /Fobuild/checksum_test.obj -D CHECKSUM_TEST
     48build/checksum_test.exe:    library/Checksum.cpp
     49    @$(CXX) /Febuild/checksum_test.exe /Ox library/Checksum.cpp /Fobuild/checksum_test.obj -D CHECKSUM_TEST
    5050
  • trunk/Serial_Server/win32/Win32.cpp

    r526 r589  
    3030#include <stdarg.h>
    3131
    32 #include "../library/library.h"
    33 #include "../library/flatimage.h"
    34 
    35 #include "../../XTIDE_Universal_BIOS/inc/version.inc"
     32#include "../library/Library.h"
     33#include "../library/FlatImage.h"
     34
     35#include "../../XTIDE_Universal_BIOS/Inc/Version.inc"
    3636
    3737char *bannerStrings[] = {
  • trunk/Serial_Server/win32/Win32File.h

    r526 r589  
    2929#include <windows.h>
    3030#include <stdio.h>
    31 #include "../library/library.h"
     31#include "../library/Library.h"
    3232
    3333class FileAccess
  • trunk/Serial_Server/win32/Win32Serial.h

    r568 r589  
    2424#include <stdio.h>
    2525#include "windows.h"
    26 #include "../library/library.h"
     26#include "../library/Library.h"
    2727
    2828#define PIPENAME "\\\\.\\pipe\\xtide"
  • trunk/XTIDE_Universal_BIOS/Inc/BootVars.inc

    r545 r589  
    4141    .dwPostStack        resb    4       ; POST stack pointer when entering INT 19h
    4242%ifdef MODULE_HOTKEYS
    43     .hotkeyVars             resb    HOTKEYVARS_size
     43    .hotkeyVars         resb    HOTKEYVARS_size
    4444%endif
    4545    .rgDrvDetectInfo:                   ; Array containing DRVDETECTINFO structs
  • trunk/XTIDE_Universal_BIOS/Inc/Controllers/AdvancedID.inc

    r588 r589  
    3232; Vision
    3333; QDI Vision Controller Identification nibbles used by hardware so do not modify these
    34 ID_QD6580_ALTERNATE         EQU     5
    35 ID_QD6580                   EQU     10
    36 ID_QD6500                   EQU     12
     34ID_QD6580_ALTERNATE         EQU     80
     35ID_QD6580                   EQU     160
     36ID_QD6500                   EQU     192
    3737
    3838
  • trunk/XTIDE_Universal_BIOS/Inc/Controllers/PDC20x30.inc

    r587 r589  
    22; Description   :   Promise PDC 20230-C and 20630 VLB IDE controller
    33;                   specifications.
    4 ;
    5 ;                   Specifications can be found at
    64
    75;
  • trunk/XTIDE_Universal_BIOS/Inc/Controllers/XTCF.inc

    r588 r589  
    5656; the mode via a call to Int 13h function 1Eh accordingly (see AH1Eh_XTCF.asm).
    5757;
    58 XTCF_8BIT_PIO_MODE                  EQU     0   ; XT-CF using 8-bit PIO mode
    59 XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD EQU     1   ; XT-CF using 8-bit PIO mode, but with 16-bit instructions
    60 XTCF_16BIT_PIO_WITH_BIU_OFFLOAD     EQU     2   ; Lo-tech 8-bit IDE Adapter
    61 XTCF_DMA_MODE                       EQU     3   ; XT-CFv3 using DMA
     58XTCF_8BIT_PIO_MODE                      EQU     0   ; XT-CF using 8-bit PIO mode
     59XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD     EQU     1   ; XT-CF using 8-bit PIO mode, but with 16-bit instructions
     60XTCF_16BIT_PIO_MODE_WITH_BIU_OFFLOAD    EQU     2   ; Lo-tech 8-bit IDE Adapter
     61XTCF_DMA_MODE                           EQU     3   ; XT-CFv3 using DMA
    6262
    6363
  • trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc

    r584 r589  
    8484
    8585
    86     ; Flags for DPT_ADVANCED_ATA.bInitError
     86    ; Flags for DPT.bInitError
    8787    FLG_INITERROR_FAILED_TO_SELECT_DRIVE                EQU (1<<0)
    8888    FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS   EQU (1<<1)
  • trunk/XTIDE_Universal_BIOS/Inc/IDE_8bit.inc

    r526 r589  
    2121%ifndef IDE_8BIT_INC
    2222%define IDE_8BIT_INC
    23 
    24 ;--------------------------------------------------------------------
    25 ; UNROLL_SECTORS_IN_CX_TO_DWORDS
    26 ; UNROLL_SECTORS_IN_CX_TO_QWORDS
    27 ; UNROLL_SECTORS_IN_CX_TO_OWORDS
    28 ;   Parameters:
    29 ;       CX:     Number of sectors in block
    30 ;   Returns:
    31 ;       CX:     Number of DWORDs, QWORDs or OWORDs in block
    32 ;   Corrupts registers:
    33 ;       Nothing
    34 ;--------------------------------------------------------------------
    35 %macro UNROLL_SECTORS_IN_CX_TO_DWORDS 0
    36 %ifdef USE_186
    37     shl     cx, 7
    38 %else
    39     xchg    cl, ch      ; Sectors to WORDs (SHL CX, 8)
    40     shr     cx, 1
    41 %endif
    42 %endmacro
    43 
    44 %macro UNROLL_SECTORS_IN_CX_TO_QWORDS 0
    45 %ifdef USE_186
    46     shl     cx, 6
    47 %else
    48     UNROLL_SECTORS_IN_CX_TO_DWORDS
    49     shr     cx, 1
    50 %endif
    51 %endmacro
    52 
    53 %macro UNROLL_SECTORS_IN_CX_TO_OWORDS 0
    54 %ifdef USE_186
    55     shl     cx, 5
    56 %else
    57 ;   UNROLL_SECTORS_IN_CX_TO_QWORDS
    58 ;   shr     cx, 1
    59     mov     ch, cl      ; 2 bytes shorter but possibly slower
    60     mov     cl, 3
    61     shr     cx, cl
    62 %endif
    63 %endmacro
    64 
    6523
    6624;--------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS/Inc/IdeIO.inc

    r526 r589  
    105105
    106106
     107;--------------------------------------------------------------------
     108; UNROLL_SECTORS_IN_CX_TO_DWORDS
     109; UNROLL_SECTORS_IN_CX_TO_QWORDS
     110; UNROLL_SECTORS_IN_CX_TO_OWORDS
     111;   Parameters:
     112;       CX:     Number of sectors in block
     113;   Returns:
     114;       CX:     Number of DWORDs, QWORDs or OWORDs in block
     115;   Corrupts registers:
     116;       Nothing
     117;--------------------------------------------------------------------
     118%macro UNROLL_SECTORS_IN_CX_TO_DWORDS 0
     119%ifdef USE_186
     120    shl     cx, 7
     121%else
     122    xchg    cl, ch      ; Sectors to WORDs (SHL CX, 8)
     123    shr     cx, 1
     124%endif
     125%endmacro
     126
     127%macro UNROLL_SECTORS_IN_CX_TO_QWORDS 0
     128%ifdef USE_186
     129    shl     cx, 6
     130%else
     131    UNROLL_SECTORS_IN_CX_TO_DWORDS
     132    shr     cx, 1
     133%endif
     134%endmacro
     135
     136%macro UNROLL_SECTORS_IN_CX_TO_OWORDS 0
     137%ifdef USE_186
     138    shl     cx, 5
     139%else
     140;   UNROLL_SECTORS_IN_CX_TO_QWORDS
     141;   shr     cx, 1
     142    mov     ch, cl      ; 2 bytes shorter but possibly slower
     143    mov     cl, 3
     144    shr     cx, cl
     145%endif
     146%endmacro
     147
     148
    107149%endif ; IDE_IO_INC
  • trunk/XTIDE_Universal_BIOS/Inc/ModuleDependency.inc

    r587 r589  
    2626%endif
    2727
    28 
    2928%ifdef MODULE_SERIAL_FLOPPY
    3029    %ifndef MODULE_SERIAL
     
    4140%endif
    4241
    43 ; Include module specific .INC files
    4442%ifdef MODULE_8BIT_IDE
    4543    %include "IDE_8bit.inc"         ; For IDE 8-bit data port macros
     
    4745
    4846%ifdef MODULE_ADVANCED_ATA
     47    %ifndef USE_386
     48        %error "MODULE_ADVANCED_ATA requires USE_386!"
     49    %endif
    4950    %include "AdvancedID.inc"
    5051    %include "PDC20x30.inc"         ; For Promise PDC 20230-C and 20630 controllers
     
    7980; Included modules for ROMVARS.wFlags
    8081%ifdef MODULE_8BIT_IDE
    81     MAIN_FLG_MODULE_8BIT_IDE    EQU FLG_ROMVARS_MODULE_8BIT_IDE
     82    MAIN_FLG_MODULE_8BIT_IDE            EQU FLG_ROMVARS_MODULE_8BIT_IDE
    8283%else
    83     MAIN_FLG_MODULE_8BIT_IDE    EQU 0
     84    MAIN_FLG_MODULE_8BIT_IDE            EQU 0
    8485%endif
    8586
    8687%ifdef MODULE_ADVANCED_ATA
    87     MAIN_FLG_MODULE_ADVANCED_ATA    EQU FLG_ROMVARS_MODULE_ADVANCED_ATA
     88    MAIN_FLG_MODULE_ADVANCED_ATA        EQU FLG_ROMVARS_MODULE_ADVANCED_ATA
    8889%else
    89     MAIN_FLG_MODULE_ADVANCED_ATA    EQU 0
     90    MAIN_FLG_MODULE_ADVANCED_ATA        EQU 0
    9091%endif
    9192
    9293%ifdef MODULE_BOOT_MENU
    93     MAIN_FLG_MODULE_BOOT_MENU   EQU FLG_ROMVARS_MODULE_BOOT_MENU
     94    MAIN_FLG_MODULE_BOOT_MENU           EQU FLG_ROMVARS_MODULE_BOOT_MENU
    9495%else
    95     MAIN_FLG_MODULE_BOOT_MENU   EQU 0
     96    MAIN_FLG_MODULE_BOOT_MENU           EQU 0
    9697%endif
    9798
    9899%ifdef MODULE_EBIOS
    99     MAIN_FLG_MODULE_EBIOS   EQU FLG_ROMVARS_MODULE_EBIOS
     100    MAIN_FLG_MODULE_EBIOS               EQU FLG_ROMVARS_MODULE_EBIOS
    100101%else
    101     MAIN_FLG_MODULE_EBIOS   EQU 0
     102    MAIN_FLG_MODULE_EBIOS               EQU 0
    102103%endif
    103104
    104105%ifdef MODULE_HOTKEYS
    105     MAIN_FLG_MODULE_HOTKEYS EQU FLG_ROMVARS_MODULE_HOTKEYS
     106    MAIN_FLG_MODULE_HOTKEYS             EQU FLG_ROMVARS_MODULE_HOTKEYS
    106107%else
    107     MAIN_FLG_MODULE_HOTKEYS EQU 0
     108    MAIN_FLG_MODULE_HOTKEYS             EQU 0
    108109%endif
    109110
    110111%ifdef MODULE_IRQ
    111     MAIN_FLG_MODULE_IRQ     EQU FLG_ROMVARS_MODULE_IRQ
     112    MAIN_FLG_MODULE_IRQ                 EQU FLG_ROMVARS_MODULE_IRQ
    112113%else
    113     MAIN_FLG_MODULE_IRQ     EQU 0
     114    MAIN_FLG_MODULE_IRQ                 EQU 0
    114115%endif
    115116
    116117%ifdef MODULE_SERIAL
    117     MAIN_FLG_MODULE_SERIAL  EQU FLG_ROMVARS_MODULE_SERIAL
     118    MAIN_FLG_MODULE_SERIAL              EQU FLG_ROMVARS_MODULE_SERIAL
    118119%else
    119     MAIN_FLG_MODULE_SERIAL  EQU 0
     120    MAIN_FLG_MODULE_SERIAL              EQU 0
    120121%endif
    121122
    122123%ifdef MODULE_SERIAL_FLOPPY
    123     MAIN_FLG_MODULE_SERIAL_FLOPPY   EQU FLG_ROMVARS_MODULE_SERIAL_FLOPPY
     124    MAIN_FLG_MODULE_SERIAL_FLOPPY       EQU FLG_ROMVARS_MODULE_SERIAL_FLOPPY
    124125%else
    125     MAIN_FLG_MODULE_SERIAL_FLOPPY   EQU 0
     126    MAIN_FLG_MODULE_SERIAL_FLOPPY       EQU 0
    126127%endif
    127128
     
    145146
    146147MASK_ROMVARS_INCLUDED_MODULES   EQU MAIN_FLG_MODULE_8BIT_IDE | MAIN_FLG_MODULE_ADVANCED_ATA | MAIN_FLG_MODULE_BOOT_MENU | MAIN_FLG_MODULE_EBIOS | MAIN_FLG_MODULE_HOTKEYS | MAIN_FLG_MODULE_IRQ | MAIN_FLG_MODULE_SERIAL | MAIN_FLG_MODULE_SERIAL_FLOPPY | MAIN_FLG_MODULE_STRINGS_COMPRESSED | MAIN_FLG_MODULE_POWER_MANAGEMENT | MAIN_FLG_MODULE_8BIT_IDE_ADVANCED
    147 
  • trunk/XTIDE_Universal_BIOS/Inc/RamVars.inc

    r555 r589  
    132132%endif
    133133
     134                            alignb  2   ; Keep the INTPACK structure and stack pointer WORD aligned
     135
    134136    .intpack                resb    INTPACK_size
    135137endstruc
  • trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc

    r588 r589  
    7171                                                ; (Conveniently, this is 8, a fact we exploit when testing the bit)
    7272
    73 ; Here in case the configuration needs to know functionality is present
     73; Here in case the configuration needs to know functionality is present. Note! Changing the order/location of these flags
     74; also requires changes elsewhere as they are usually tested using byte-accesses for efficiency.
    7475FLG_ROMVARS_MODULE_POWER_MANAGEMENT     EQU (1<<5)
    7576FLG_ROMVARS_MODULE_8BIT_IDE             EQU (1<<6)
     
    146147; Device types for IDEVARS.bDevice
    147148; IDE Devices are grouped so device numbers cannot be changed without modifying code elsewhere!
    148 ; (IdeTransfer.asm)
    149149COUNT_OF_STANDARD_IDE_DEVICES           EQU 2   ; 16- and 32-bit controllers
    150150COUNT_OF_8BIT_IDE_DEVICES               EQU 9
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm

    r584 r589  
    3333IdeCommand_ResetMasterAndSlaveController:
    3434    ; HSR0: Set_SRST
    35     call    AccessDPT_GetDeviceControlByteToAL
    36     or      al, FLG_DEVCONTROL_SRST | FLG_DEVCONTROL_nIEN   ; Set Reset bit
     35; Used to be:
     36;   call    AccessDPT_GetDeviceControlByteToAL
     37;   or      al, FLG_DEVCONTROL_SRST | FLG_DEVCONTROL_nIEN   ; Set Reset bit
     38; Is now:
     39    mov     al, FLG_DEVCONTROL_SRST | FLG_DEVCONTROL_nIEN
     40; ---
    3741    OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER     DEVICE_CONTROL_REGISTER_out
    3842    mov     ax, HSR0_RESET_WAIT_US
     
    4044
    4145    ; HSR1: Clear_wait
    42     call    AccessDPT_GetDeviceControlByteToAL
    43     or      al, FLG_DEVCONTROL_nIEN
    44     and     al, ~FLG_DEVCONTROL_SRST                        ; Clear reset bit
     46; Used to be:
     47;   call    AccessDPT_GetDeviceControlByteToAL
     48;   or      al, FLG_DEVCONTROL_nIEN
     49;   and     al, ~FLG_DEVCONTROL_SRST                        ; Clear reset bit
     50; Is now:
     51    mov     al, FLG_DEVCONTROL_nIEN
     52; ---
    4553    OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER     DEVICE_CONTROL_REGISTER_out
    4654    mov     ax, HSR1_RESET_WAIT_US
     
    5159    jmp     IdeWait_PollStatusFlagInBLwithTimeoutInBH
    5260
     61; *FIXME* AccessDPT_GetDeviceControlByteToAL currently always returns with
     62; AL cleared (0) or with only bit 1 set (FLG_DEVCONTROL_nIEN = 2).
     63; The commented away instructions above sets FLG_DEVCONTROL_nIEN anyway
     64; making the call to AccessDPT_GetDeviceControlByteToAL redundant.
     65; I have left this code as is since I don't know if it's a mistake
     66; (from all the way back to r150) or if it's coded this way in anticipation
     67; of some future changes to AccessDPT_GetDeviceControlByteToAL.
    5368
    5469;--------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDmaBlock.asm

    r567 r589  
    9494    ; When DI is zero only one transfer is required since we've limited the
    9595    ; XT-CFv3 block size to 32k
    96     jnc     SHORT .TransferLastDmaPageWithSizeInCX
     96    jnc     SHORT StartDMAtransferForXTCFwithDmaModeInBL
    9797
    9898    ; CF was set, so DI != 0 and we might need one or two transfers
    99     cmp     cx, ax                                  ; if we won't cross a physical page boundary...
    100     jbe     SHORT .TransferLastDmaPageWithSizeInCX  ; ...perform the transfer in one operation
     99    cmp     cx, ax                                          ; if we won't cross a physical page boundary...
     100    jbe     SHORT StartDMAtransferForXTCFwithDmaModeInBL    ; ...perform the transfer in one operation
    101101
    102102    ; Calculate how much we can transfer on first and second rounds
     
    108108    call    StartDMAtransferForXTCFwithDmaModeInBL
    109109    pop     cx                                      ; Pop size for second DMA page
    110 
    111 .TransferLastDmaPageWithSizeInCX:
    112110    ; Fall to StartDMAtransferForXTCFwithDmaModeInBL
    113111
     
    115113;--------------------------------------------------------------------
    116114; StartDMAtransferForXTCFwithDmaModeInBL
    117 ; Updated for XT-CFv3, 11-Apr-13
    118115;   Parameters:
    119116;       BL:     Byte for DMA Mode Register
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdePioBlock.asm

    r580 r589  
    2929; --------------------------------------------------------------------------------------------------
    3030
    31 
    3231%ifdef MODULE_8BIT_IDE
    33 
    3432;--------------------------------------------------------------------
    3533; IdePioBlock_ReadFromXtideRev1
     
    5755
    5856;--------------------------------------------------------------------
     57; 8-bit PIO from a single data port.
     58;
    5959; IdePioBlock_ReadFrom8bitDataPort
    60 ;
    61 ; 8-bit PIO from a single data port.
    62 ;
    6360;   Parameters:
    6461;       CX:     Block size in 512 byte sectors
     
    6865;       Nothing
    6966;   Corrupts registers:
    70 ;       AX, BX, CX
     67;       AX, CX
    7168;--------------------------------------------------------------------
    7269ALIGN JUMP_ALIGN
     
    8784    ret
    8885%endif
    89 
    90 %endif  ; MODULE_8BIT_IDE
    91 
    92 
    93 ;--------------------------------------------------------------------
     86%endif ; MODULE_8BIT_IDE
     87
     88
     89;--------------------------------------------------------------------
     90; 16-bit and 32-bit PIO from a single data port.
     91;
    9492; IdePioBlock_ReadFrom16bitDataPort
    95 ;
    96 ; 16-bit PIO from a single data port.
    97 ;
     93; IdePioBlock_ReadFrom32bitDataPort
    9894;   Parameters:
    9995;       CX:     Block size in 512 byte sectors
     
    10399;       Nothing
    104100;   Corrupts registers:
    105 ;       AX, BX, CX
     101;       AX, CX
    106102;--------------------------------------------------------------------
    107103ALIGN JUMP_ALIGN
    108104IdePioBlock_ReadFrom16bitDataPort:
    109105%ifdef USE_186
    110     xchg    cl, ch  ; Sectors to WORDs
     106    xchg    cl, ch      ; Sectors to WORDs
    111107    rep insw
    112108    ret
     
    126122
    127123;--------------------------------------------------------------------
     124%ifdef MODULE_ADVANCED_ATA
    128125ALIGN JUMP_ALIGN
    129126IdePioBlock_ReadFrom32bitDataPort:
    130     db      0C1h        ; SHL
    131     db      0E1h        ; CX
    132     db      7           ; 7 (Sectors to DWORDs)
    133     rep
    134     db      66h         ; Override operand size to 32-bit
    135     db      6Dh         ; INSW/INSD
    136     ret
    137 
     127    shl     cx, 7       ; Sectors to DWORDs
     128    rep insd
     129    ret
     130%endif ; MODULE_ADVANCED_ATA
    138131
    139132
     
    145138
    146139%ifdef MODULE_8BIT_IDE
    147 
    148140;--------------------------------------------------------------------
    149141; IdePioBlock_WriteToXtideRev1
     
    151143;       CX:     Block size in 512-byte sectors
    152144;       DX:     IDE Data port address
    153 ;       ES:SI:  Normalized ptr to buffer containing data
     145;       DS:SI:  Normalized ptr to buffer containing data
    154146;   Returns:
    155147;       Nothing
     
    159151ALIGN JUMP_ALIGN
    160152IdePioBlock_WriteToXtideRev1:
    161     push    ds
    162153    UNROLL_SECTORS_IN_CX_TO_QWORDS
    163154    mov     bl, 8       ; Bit mask for toggling data low/high reg
    164     push    es
    165     pop     ds
    166155ALIGN JUMP_ALIGN
    167156.OutswLoop:
     
    170159    %endrep
    171160    loop    .OutswLoop
    172     pop     ds
    173161    ret
    174162
     
    179167;       CX:     Block size in 512-byte sectors
    180168;       DX:     IDE Data port address
    181 ;       ES:SI:  Normalized ptr to buffer containing data
    182 ;   Returns:
    183 ;       Nothing
    184 ;   Corrupts registers:
    185 ;       AX, BX, CX
     169;       DS:SI:  Normalized ptr to buffer containing data
     170;   Returns:
     171;       Nothing
     172;   Corrupts registers:
     173;       AX, CX
    186174;--------------------------------------------------------------------
    187175ALIGN JUMP_ALIGN
    188176IdePioBlock_WriteToXtideRev2:
    189177    UNROLL_SECTORS_IN_CX_TO_QWORDS
    190     push    ds
    191     push    es
    192     pop     ds
    193178ALIGN JUMP_ALIGN
    194179.WriteNextQword:
     
    197182    %endrep
    198183    loop    .WriteNextQword
    199     pop     ds
    200184    ret
    201185
     
    206190;       CX:     Block size in 512-byte sectors
    207191;       DX:     IDE Data port address
    208 ;       ES:SI:  Normalized ptr to buffer containing data
    209 ;   Returns:
    210 ;       Nothing
    211 ;   Corrupts registers:
    212 ;       AX, BX, CX
     192;       DS:SI:  Normalized ptr to buffer containing data
     193;   Returns:
     194;       Nothing
     195;   Corrupts registers:
     196;       AX, CX
    213197;--------------------------------------------------------------------
    214198ALIGN JUMP_ALIGN
     
    216200%ifdef USE_186
    217201    shl     cx, 9       ; Sectors to BYTEs
    218     es                  ; Source is ES segment
    219202    rep outsb
    220203    ret
     
    222205%else ; 808x
    223206    UNROLL_SECTORS_IN_CX_TO_QWORDS
    224     push    ds
    225     push    es
    226     pop     ds
    227207ALIGN JUMP_ALIGN
    228208.WriteNextQword:
     
    232212    %endrep
    233213    loop    .WriteNextQword
    234     pop     ds
    235     ret
    236 %endif
    237 
     214    ret
     215%endif
    238216%endif ; MODULE_8BIT_IDE
    239217
     
    245223;       CX:     Block size in 512-byte sectors
    246224;       DX:     IDE Data port address
    247 ;       ES:SI:  Normalized ptr to buffer containing data
    248 ;   Returns:
    249 ;       Nothing
    250 ;   Corrupts registers:
    251 ;       AX, BX, CX
     225;       DS:SI:  Normalized ptr to buffer containing data
     226;   Returns:
     227;       Nothing
     228;   Corrupts registers:
     229;       AX, CX
    252230;--------------------------------------------------------------------
    253231ALIGN JUMP_ALIGN
     
    255233%ifdef USE_186
    256234    xchg    cl, ch      ; Sectors to WORDs
    257     es                  ; Source is ES segment
    258235    rep outsw
    259236    ret
     
    261238%else ; 808x
    262239    UNROLL_SECTORS_IN_CX_TO_QWORDS
    263     push    ds
    264     push    es
    265     pop     ds
    266240ALIGN JUMP_ALIGN
    267241.WriteNextQword:
     
    271245    %endrep
    272246    loop    .WriteNextQword
    273     pop     ds
    274     ret
    275 %endif
    276 
    277 ;--------------------------------------------------------------------
     247    ret
     248%endif
     249
     250;--------------------------------------------------------------------
     251%ifdef MODULE_ADVANCED_ATA
    278252ALIGN JUMP_ALIGN
    279253IdePioBlock_WriteTo32bitDataPort:
    280     db      0C1h        ; SHL
    281     db      0E1h        ; CX
    282     db      7           ; 7 (Sectors to DWORDs)
    283     es                  ; Source is ES segment
    284     rep
    285     db      66h         ; Override operand size to 32-bit
    286     db      6Fh         ; OUTSW/OUTSD
    287     ret
     254    shl     cx, 7       ; Sectors to DWORDs
     255    rep outsd
     256    ret
     257%endif ; MODULE_ADVANCED_ATA
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm

    r584 r589  
    173173    cmp     [bp+PIOVARS.bSectorsLeft], cl
    174174    jbe     SHORT .WriteLastBlockToDrive
     175    push    ds
     176    push    es
     177    pop     ds
    175178    call    [bp+PIOVARS.fnXfer]
    176 
     179    pop     ds
    177180    ; Wait until ready for next block and check for errors
    178181    call    IdeWait_IRQorDRQ                    ; Wait until ready to transfer
     
    189192    mov     cl, [bp+PIOVARS.bSectorsLeft]       ; CH is already zero
    190193    push    cx
     194    push    ds
     195    push    es
     196    pop     ds
    191197    call    [bp+PIOVARS.fnXfer]                 ; Transfer possibly partial block
     198    pop     ds
    192199    jmp     SHORT CheckErrorsAfterTransferringLastBlock
    193200
     
    237244    ; Convert ES:SI to physical address
    238245%ifdef USE_386
    239 
    240246    mov     dx, es
    241247    xor     ax, ax
     
    247253
    248254%elifdef USE_186
    249                         ; Bytes EU Cycles(286)
    250     mov     ax, es      ; 2     2
    251     rol     ax, 4       ; 3     9
    252     mov     dx, ax      ; 2     2
    253     and     ax, BYTE 0Fh; 3     3
    254     xor     dx, ax      ; 2     2
    255     add     si, dx      ; 2     2
    256     adc     al, ah      ; 2     2
    257     mov     es, ax      ; 2     2
    258     ;------------------------------------
    259                         ; 18    24
     255    mov     ax, es
     256    rol     ax, 4
     257    mov     dx, ax
     258    and     ax, 0Fh
     259    xor     dx, ax
     260    add     si, dx
     261    adc     al, ah
     262    mov     es, ax
     263
    260264%else ; 808x
    261                         ; Bytes EU Cycles(808x)
    262     mov     al, 4       ; 2     4
    263     mov     dx, es      ; 2     2
    264     xchg    cx, ax      ; 1     3
    265     rol     dx, cl      ; 2     24
    266     mov     cx, dx      ; 2     2
    267     xchg    cx, ax      ; 1     3
    268     and     ax, BYTE 0Fh; 3     4
    269     xor     dx, ax      ; 2     3
    270     add     si, dx      ; 2     3
    271     adc     al, ah      ; 2     3
    272     mov     es, ax      ; 2     2
    273     ;------------------------------------
    274                         ; 21    53
    275 ;
    276 ; Judging by the Execution Unit cycle count the above block of code is
    277 ; apparently slower. However, the shifts and rotates in the block below
    278 ; execute faster than the Bus Interface Unit on an 8088 can fetch them,
    279 ; thus causing the EU to starve. The difference in true execution speed
    280 ; (if any) might not be worth the extra 5 bytes.
    281 ; In other words, we could use a real world test here.
    282 ;
    283 %if 0
    284                         ; Bytes EU Cycles(808x/286)
    285     xor     dx, dx      ; 2     3/2
    286     mov     ax, es      ; 2     2/2
    287 %rep 4
    288     shl     ax, 1       ; 8     8/8
    289     rcl     dx, 1       ; 8     8/8
    290 %endrep
    291     add     si, ax      ; 2     3/2
    292     adc     dl, dh      ; 2     3/2
    293     mov     es, dx      ; 2     2/2
    294     ;------------------------------------
    295                         ; 26    29/26
    296 %endif ; 0
     265    mov     al, 4
     266    mov     dx, es
     267    xchg    cx, ax
     268    rol     dx, cl
     269    mov     cx, dx
     270    xchg    cx, ax
     271    and     ax, 0Fh
     272    xor     dx, ax
     273    add     si, dx
     274    adc     al, ah
     275    mov     es, ax
     276
    297277%endif
    298278
     
    334314%ifdef USE_AT       ; CF is always clear for XT builds
    335315    ; AH = RET_HD_INVALID (01) if CF set, RET_HD_SUCCESS (00) if not. CF unchanged.
     316%ifdef USE_386
     317    setc    ah
     318%else
    336319    sbb     ah, ah
    337320    neg     ah
    338321%endif
     322%endif ; USE_AT
    339323    ret
    340324
     
    345329g_rgfnPioRead:
    346330        dw      IdePioBlock_ReadFrom16bitDataPort   ; 0, DEVICE_16BIT_ATA
     331%ifdef MODULE_ADVANCED_ATA
    347332        dw      IdePioBlock_ReadFrom32bitDataPort   ; 1, DEVICE_32BIT_ATA
     333%elifdef MODULE_8BIT_IDE
     334        dw      NULL
     335%endif ; MODULE_ADVANCED_ATA
    348336%ifdef MODULE_8BIT_IDE
    349337        dw      IdePioBlock_ReadFrom8bitDataPort    ; 2, DEVICE_8BIT_ATA
     
    361349g_rgfnPioWrite:
    362350        dw      IdePioBlock_WriteTo16bitDataPort    ; 0, DEVICE_16BIT_ATA
     351%ifdef MODULE_ADVANCED_ATA
    363352        dw      IdePioBlock_WriteTo32bitDataPort    ; 1, DEVICE_32BIT_ATA
     353%elifdef MODULE_8BIT_IDE
     354        dw      NULL
     355%endif ; MODULE_ADVANCED_ATA
    364356%ifdef MODULE_8BIT_IDE
    365357        dw      IdePioBlock_WriteTo8bitDataPort     ; 2, DEVICE_8BIT_ATA
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm

    r568 r589  
    9898%endif
    9999    cld                                 ; String instructions to increment pointers
    100     CREATE_FRAME_INTPACK_TO_SSBP    SIZE_OF_IDEPACK_WITHOUT_INTPACK
     100    ePUSHA
     101    push    ds
     102    push    es
     103%ifdef USE_386
     104;   push    fs
     105;   push    gs
     106%endif
     107    sub     sp, BYTE SIZE_OF_IDEPACK_WITHOUT_INTPACK
     108    mov     bp, sp
    101109    call    RamVars_GetSegmentToDS
    102110
     
    297305    ; on INT 13h to enable interrupts.
    298306    or      BYTE [bp+IDEPACK.intpack+INTPACK.flags+1], (FLG_FLAGS_IF>>8)
    299     mov     sp, bp  ; This makes possible to exit anytime, no matter what is on stack
    300     RESTORE_FRAME_INTPACK_FROM_SSBP     SIZE_OF_IDEPACK_WITHOUT_INTPACK
     307
     308    lea     sp, [bp+SIZE_OF_IDEPACK_WITHOUT_INTPACK]
     309%ifdef USE_386
     310;   pop     gs
     311;   pop     fs
     312%endif
     313    pop     es
     314    pop     ds
     315    ePOPA
     316    iret
    301317
    302318
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1Eh_XTCF.asm

    r588 r589  
    152152
    153153
    154 %if 0
    155     ; We always need to enable 8-bit mode since 16-bit mode is restored
    156     ; when controller is reset (AH=00h or 0Dh)
    157     ePUSH_T bx, AH23h_Enable8bitPioMode
    158 
    159     ; Convert mode to device type (see XTCF.inc for full details)
    160     and     ax, 3
    161     jz      SHORT .Set8bitPioMode   ; XTCF_8BIT_PIO_MODE = 0
    162     dec     ax                      ; XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD = 1
    163     jz      SHORT .Set8bitPioModeWithBIUOffload
    164     dec     ax                      ; XTCF_16BIT_PIO_WITH_BIU_OFFLOAD = 2
    165     jz      SHORT .Set16bitPioModeWithBIUOffload
    166 
    167     ; XTCF_DMA_MODE = 3
    168     mov     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA
    169 
    170     ; DMA transfers have limited block size
    171     mov     al, [di+DPT_ATA.bBlockSize]
    172     cmp     al, XTCF_DMA_MODE_MAX_BLOCK_SIZE
    173     jbe     SHORT AH24h_SetBlockSize
    174     mov     al, XTCF_DMA_MODE_MAX_BLOCK_SIZE
    175     jmp     SHORT AH24h_SetBlockSize
    176 
    177 .Set16bitPioModeWithBIUOffload:
    178     pop     bx                              ; Do not enable 8-bit PIO...
    179     ePUSH_T bx, AH23h_Disable8bitPioMode    ; ...disable it instead
    180     mov     al, DEVICE_8BIT_XTCF_PIO16_WITH_BIU_OFFLOAD
    181     SKIP2B  bx
    182 
    183 .Set8bitPioMode:
    184     mov     al, DEVICE_8BIT_XTCF_PIO8
    185     SKIP2B  bx
    186 
    187 .Set8bitPioModeWithBIUOffload:
    188     mov     al, DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD
    189     mov     [di+DPT_ATA.bDevice], al
    190     ret
    191 %endif ; 0
    192 
    193 
    194154;--------------------------------------------------------------------
    195155; AH1Eh_GetCurrentXTCFmodeToAX
     
    197157;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    198158;   Returns:
    199 ;       AX:     XT-CF mode (XTCF_8BIT_PIO_MODE, XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD, XTCF_16BIT_PIO_WITH_BIU_OFFLOAD or XTCF_DMA_MODE)
     159;       AX:     XT-CF mode (see XTCF.inc)
    200160;       CF:     Clear
    201161;   Corrupts registers:
     
    208168    ret
    209169
    210 %if 0
    211     mov     al, [di+DPT_ATA.bDevice]
    212     shr     al, 1
    213     cbw
    214     sub     al, XTCF_DEVICE_OFFSET >> 1
    215     ret
    216 %endif ; 0
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH23h_HFeatures.asm

    r584 r589  
    9292    mov     si, FEATURE_ENABLE_8BIT_PIO_TRANSFER_MODE
    9393    jmp     SHORT AH23h_SetControllerFeatures
     94
     95%ifdef MODULE_8BIT_IDE_ADVANCED
    9496AH23h_Disable8bitPioMode:
    9597    mov     si, FEATURE_DISABLE_8BIT_PIO_TRANSFER_MODE
     
    9799    xor     ah, ah          ; Clear error since modern drives might not understand the command and are
    98100    ret                     ; always in 16-bit mode anyway
    99 %endif
     101%endif ; MODULE_8BIT_IDE_ADVANCED
     102%endif ; MODULE_8BIT_IDE
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH2h_HRead.asm

    r526 r589  
    4040;       AH:     Int 13h/40h floppy return status
    4141;       AL:     Burst error length if AH returns 11h (we never return error code 11h)
    42 ;               Number of sectors actually read (only valid if CF set for someBIOSes)
     42;               Number of sectors actually read (only valid if CF set for some BIOSes)
    4343;       CF:     0 if successful, 1 if error
    4444;--------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH3h_HWrite.asm

    r526 r589  
    3939;   Returns with INTPACK:
    4040;       AH:     Int 13h/40h floppy return status
    41 ;       AL:     Number of sectors actually written (only valid if CF set for someBIOSes)
     41;       AL:     Number of sectors actually written (only valid if CF set for some BIOSes)
    4242;       CF:     0 if successful, 1 if error
    4343;--------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm

    r588 r589  
    184184
    185185    ; Advanced PIO mode 3 and above
    186     mov     dl, [di+DPT_ADVANCED_ATA.bPioMode]
    187     or      dl, PIO_FLOW_CONTROL_MODE_xxx
     186    mov     dl, PIO_FLOW_CONTROL_MODE_xxx
     187    or      dl, [di+DPT_ADVANCED_ATA.bPioMode]
    188188
    189189.IordyNotSupported:
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Address.asm

    r568 r589  
    174174    ; +=sectToSeek-1 (24-bit result)
    175175    ; Max = 16,450,497 + 63 - 1 = 16,450,559 = FB03FFh
    176     xor     bh, bh                  ; Sector number now in BX
     176    mov     bh, ch                  ; Sector number now in BX, CH=zero
    177177    dec     bx                      ; sectToSeek-=1
    178     add     ax, bx                  ; Add to loword
    179     adc     dl, bh                  ; Add possible carry to byte2, BH=zero
    180 
    181     ; Copy DX:AX to proper return registers
    182     xchg    bx, ax                  ; BL = Sector Number Register (LBA 7...0)
    183     mov     cl, bh                  ; Low Cylinder Register (LBA 15...8)
    184     mov     ch, dl                  ; High Cylinder Register (LBA 23...16)
    185     mov     bh, dh                  ; Drive and Head Register (LBA 27...24)
     178    add     bx, ax                  ; Add loword to BX (BL = Sector Number Register (LBA 7...0))
     179    adc     ch, dl                  ; Add possible carry to byte2 (CH = High Cylinder Register (LBA 23...16))
     180    mov     cl, bh                  ; CL = Low Cylinder Register (LBA 15...8)
     181    mov     bh, dh                  ; BH = Drive and Head Register (LBA 27...24)
    186182    ret
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/AdvAtaInit.asm

    r587 r589  
    3737AdvAtaInit_DetectControllerForIdeBaseInBX:
    3838    call    Vision_DetectAndReturnIDinAXandPortInDXifControllerPresent
    39     jne     SHORT .NoAdvancedControllerForPortBX
     39    jnz     SHORT .NoVisionControllerFound
     40
    4041    call    Vision_DoesIdePortInBXbelongToControllerWithIDinAX
    41     jne     SHORT .NoAdvancedControllerForPortBX
     42    jz      SHORT .AdvancedControllerFoundForPortBX
     43
     44.NoVisionControllerFound:
    4245    call    PDC20x30_DetectControllerForIdeBaseInBX
    4346    jnc     SHORT .NoAdvancedControllerForPortBX
    4447
    45     stc     ; Advanced Controller found for port BX
     48.AdvancedControllerFoundForPortBX:
     49    stc
    4650    ret
    4751
    4852.NoAdvancedControllerForPortBX:
    49     xor     ax, ax
     53    xor     ax, ax      ; Clear ID in AX and CF
    5054    ret
    5155
     
    6670AdvAtaInit_GetControllerMaxPioModeToALandMinPioCycleTimeToBX:
    6771    cmp     ah, ID_QD6580_ALTERNATE
     72%ifdef USE_386
     73    jae     Vision_GetMaxPioModeToALandMinCycleTimeToBX
     74    jmp     PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX
     75%else
    6876    jae     SHORT .Vision
    6977    jmp     PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX
    7078.Vision:
    7179    jmp     Vision_GetMaxPioModeToALandMinCycleTimeToBX
     80%endif
    7281
    7382
     
    8897    test    ax, ax
    8998    jz      SHORT .NoAdvancedController ; Return with CF cleared
    90    
     99
    91100    cmp     ah, ID_QD6580_ALTERNATE
    92101    jae     SHORT .Vision
     
    98107
    99108    call    AdvAtaInit_LoadMasterDPTtoDSSIifSlaveInDSDI
    100     call    Vision_InitializeWithIDinAHandConfigInAL
     109    call    Vision_InitializeWithIDinAH
    101110    xor     ax, ax                      ; Success
    102111
     
    116125;               Zero if Slave Drive not present
    117126;   Corrupts registers:
    118 ;       AX
     127;       AL
    119128;--------------------------------------------------------------------
    120129AdvAtaInit_LoadMasterDPTtoDSSIifSlaveInDSDI:
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/PDC20x30.asm

    r588 r589  
    3636    mov     dx, bx
    3737    call    EnablePdcProgrammingMode
    38     jz      .ControllerDetected
    39     clc
    40     ret
    41 .ControllerDetected:
    42     call    GetPdcIDtoAX
     38    jnz     SHORT DisablePdcProgrammingMode.Return  ; PDC controller not detected
     39;   ePUSH_T ax, DisablePdcProgrammingMode           ; Uncomment this if GetPdcIDtoAX needs to be a real function
     40    ; Fall to GetPdcIDtoAX
     41
     42;--------------------------------------------------------------------
     43; Programming mode must be enabled for this function.
     44; This function also enables PDC 20630 extra registers.
     45;
     46; GetPdcIDtoAX
     47;   Parameters:
     48;       DX:     IDE Base port
     49;   Returns:
     50;       AH:     PDC ID
     51;   Corrupts registers:
     52;       AL, BX
     53;--------------------------------------------------------------------
     54GetPdcIDtoAX:
     55    push    dx
     56
     57    ; Try to enable PDC 20630 extra registers
     58    add     dx, BYTE LOW_CYLINDER_REGISTER
     59    in      al, dx
     60    or      al, FLG_PDCLCR_ENABLE_EXTRA_REGISTERS
     61    out     dx, al
     62
     63    ; Try to access PDC 20630 registers to see if they are available
     64    ; Hopefully this does not cause problems for systems with PDC 20230
     65    add     dx, BYTE PDC20630_INDEX_REGISTER - LOW_CYLINDER_REGISTER
     66    mov     al, PDCREG7_STATUS  ; Try to access PDC 20630 status register
     67    out     dx, al
     68    xchg    bx, ax
     69    in      al, dx              ; Does index register contain status register index?
     70    cmp     al, bl
     71    mov     ah, ID_PDC20630
     72    eCMOVNE ah, ID_PDC20230
     73
     74    pop     dx
     75;   ret                         ; Uncomment this to make GetPdcIDtoAX a real function
    4376    ; Fall to DisablePdcProgrammingMode
    4477
     
    4982;       DX:     Base port
    5083;   Returns:
    51 ;       Nothing
     84;       CF:     Set
    5285;   Corrupts registers:
    5386;       AL
     
    5689    add     dx, BYTE HIGH_CYLINDER_REGISTER
    5790    in      al, dx
    58     sub     dx, BYTE HIGH_CYLINDER_REGISTER
    59     stc     ; Set for PDC20x30_DetectControllerForIdeBaseInBX
     91    add     dx, -HIGH_CYLINDER_REGISTER     ; Sets CF for PDC20x30_DetectControllerForIdeBaseInBX
     92.Return:
    6093    ret
    6194
     
    6699;       DX:     Base port
    67100;   Returns:
     101;       CF:     Cleared
    68102;       ZF:     Set if programming mode enabled
    69103;   Corrupts registers:
     
    72106EnablePdcProgrammingMode:
    73107    ; Set bit 7 to sector count register
    74     add     dx, BYTE SECTOR_COUNT_REGISTER
    75     in      al, dx
     108    inc     dx
     109    inc     dx
     110    in      al, dx  ; 1F2h (SECTOR_COUNT_REGISTER)
    76111    or      al, 80h
    77112    out     dx, al
     
    93128    ; PDC20230C and PDC20630 clears the bit we set at the beginning
    94129    in      al, dx
    95     sub     dx, BYTE SECTOR_COUNT_REGISTER
    96     test    al, 80h
    97     ret
    98 
    99 
    100 ;--------------------------------------------------------------------
    101 ; Programming mode must be enabled for this function.
    102 ; This function also enables PDC 20630 extra registers.
    103 ;
    104 ; GetPdcIDtoAX
    105 ;   Parameters:
    106 ;       DX:     IDE Base port
    107 ;   Returns:
    108 ;       AX:     PDC ID word
    109 ;   Corrupts registers:
    110 ;       BX
    111 ;--------------------------------------------------------------------
    112 GetPdcIDtoAX:
    113     ; Try to enable PDC 20630 extra registers
    114     add     dx, BYTE LOW_CYLINDER_REGISTER
    115     in      al, dx
    116     or      al, FLG_PDCLCR_ENABLE_EXTRA_REGISTERS
    117     out     dx, al
    118 
    119     ; Try to access PDC 20630 registers to see if they are available
    120     ; Hopefully this does not cause problems for systems with PDC 20230
    121     add     dx, BYTE PDC20630_INDEX_REGISTER - LOW_CYLINDER_REGISTER
    122     mov     al, PDCREG7_STATUS  ; Try to access PDC 20630 status register
    123     out     dx, al
    124     xchg    bx, ax
    125     in      al, dx              ; Does index register contain status register index?
    126     cmp     al, bl
    127     mov     ah, ID_PDC20630
    128     eCMOVNE ah, ID_PDC20230
     130    dec     dx
     131    dec     dx      ; Base port
     132    test    al, 80h ; Clears CF
    129133    ret
    130134
     
    145149PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX:
    146150    cmp     ah, ID_PDC20630
    147     je      SHORT .return       ; No need to limit anything
     151    je      SHORT .Return       ; No need to limit anything
    148152    mov     ax, 2               ; Limit PIO to 2 for ID_PDC20230
    149153    mov     bx, PIO_2_MIN_CYCLE_TIME_NS
    150154    stc
    151 .return:
     155.Return:
    152156    ret
    153157
     
    165169;--------------------------------------------------------------------
    166170PDC20x30_InitializeForDPTinDSDI:
     171%ifdef USE_386
     172    xor     ch, ch
     173    test    BYTE [di+DPT.bFlagsLow], FLGL_DPT_SLAVE
     174    setnz   cl
     175%else
    167176    xor     cx, cx
    168177    test    BYTE [di+DPT.bFlagsLow], FLGL_DPT_SLAVE
    169     eCSETNZ cl
     178    jz      SHORT .NotSlave
     179    inc     cx
     180.NotSlave:
     181%endif
    170182
    171183    mov     dx, [di+DPT.wBasePort]
     
    173185    call    SetSpeedForDriveInCX
    174186    cmp     BYTE [di+DPT_ADVANCED_ATA.wControllerID+1], ID_PDC20630
    175     jne     .initializationCompleted
     187    jne     SHORT .InitializationCompleted
    176188    call    SetPdc20630SpeedForDriveInCX
    177 .initializationCompleted:
     189.InitializationCompleted:
    178190    mov     dx, [di+DPT.wBasePort]
    179191    call    DisablePdcProgrammingMode
     
    201213    mov     bh, ~MASK_PDCSCR_DEV1SPEED  ; Assume slave
    202214    inc     cx
    203     loop    .setSpeed
     215    loop    .SetSpeed
    204216    eSHL_IM bl, POS_PDCSCR_DEV0SPEED
    205217    mov     bh, ~MASK_PDCSCR_DEV0SPEED
    206 .setSpeed:
     218.SetSpeed:
    207219    in      al, dx
    208220    and     al, bh
    209221    or      al, bl
    210222    cmp     bl, 7
    211     jb      SHORT OutputNewValue
     223    jb      SHORT .OutputNewValue
    212224    or      al, FLG_PDCSCR_UNKNOWN_BIT7 ; Flag for PIO 2 and above?
    213     jmp     SHORT OutputNewValue
     225.OutputNewValue:
     226    out     dx, al
     227    ret
    214228
    215229.rgbPioModeToPDCspeedValue:
     
    228242;       DX:     Low Cylinder Register
    229243;   Corrupts registers:
    230 ;       AX, CX
     244;       AX
    231245;--------------------------------------------------------------------
    232246SetPdc20630SpeedForDriveInCX:
    233247    inc     dx      ; LOW_CYLINDER_REGISTER
    234     mov     ah, FLG_PDCLCR_DEV0SPEED_BIT4 | FLG_PDCLCR_DEV0IORDY
    235     shr     ah, cl
    236     in      al, dx
    237     not     ah
     248    mov     ah, ~(FLG_PDCLCR_DEV0SPEED_BIT4 | FLG_PDCLCR_DEV0IORDY)
     249    ror     ah, cl
     250    in      al, dx
    238251    and     al, ah  ; Clear drive specific bits
    239252    cmp     BYTE [di+DPT_ADVANCED_ATA.bPioMode], 2
    240     jbe     .clearBitsOnly
     253    jbe     .ClearBitsOnly
    241254    not     ah
    242255    or      al, ah
    243 .clearBitsOnly:
    244 OutputNewValue:
    245     out     dx, al
    246     ret
    247 
     256.ClearBitsOnly:
     257    out     dx, al
     258    ret
     259
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/Vision.asm

    r582 r589  
    2929;       AX:     ID WORD specific for QDI Vision Controllers
    3030;               (AL = QD65xx Config Register contents)
    31 ;               (AH = QDI Vision Controller ID (bits 4...7))
     31;               (AH = QDI Vision Controller ID)
    3232;       DX:     Controller port (not IDE port)
    3333;       ZF:     Set if controller found
     
    4646    ; from Axh to Bxh.
    4747    call    IsConfigRegisterWithIDinAL
    48     je      SHORT VisionControllerDetected
     48    je      SHORT VisionControllerDetected.Return
    4949
    5050    ; Check QD65xx alternative base port
    51     or      dl, QD65XX_ALTERNATIVE_BASE_PORT
     51    mov     dl, QD65XX_ALTERNATIVE_BASE_PORT
    5252    in      al, QD65XX_ALTERNATIVE_BASE_PORT + QD65XX_CONFIG_REGISTER_in
    5353%endif ; DANGEROUS_DETECTION
     
    6868    mov     ah, al
    6969    and     al, MASK_QDCONFIG_CONTROLLER_ID
    70     cmp     al, ID_QD6500 << 4
     70    cmp     al, ID_QD6500
    7171    je      SHORT VisionControllerDetected
    72     cmp     al, ID_QD6580 << 4
     72    cmp     al, ID_QD6580
    7373    je      SHORT VisionControllerDetected
    74     cmp     al, ID_QD6580_ALTERNATE << 4
     74    cmp     al, ID_QD6580_ALTERNATE
    7575VisionControllerDetected:
    7676    xchg    ah, al
     77.Return:
    7778    ret
    7879
     
    8283;   Parameters:
    8384;       AL:     QD65xx Config Register contents
    84 ;       AH:     QDI Vision Controller ID (bits 4...7)
     85;       AH:     QDI Vision Controller ID
    8586;       BX:     IDE Base port to check
    8687;       DX:     Vision Controller port
     
    9293;--------------------------------------------------------------------
    9394Vision_DoesIdePortInBXbelongToControllerWithIDinAX:
    94     cmp     ah, ID_QD6500 << 4
     95    cmp     ah, ID_QD6500
    9596    je      SHORT .DoesIdePortInDXbelongToQD6500
    9697
     
    128129;   Parameters:
    129130;       AL:     QD65xx Config Register contents
    130 ;       AH:     QDI Vision Controller ID (bits 4...7)
     131;       AH:     QDI Vision Controller ID
    131132;   Returns:
    132133;       AL:     Max supported PIO mode
     
    139140;--------------------------------------------------------------------
    140141Vision_GetMaxPioModeToALandMinCycleTimeToBX:
    141     cmp     ah, ID_QD6500 << 4
     142    cmp     ah, ID_QD6500
    142143    jne     SHORT .NoNeedToLimitForQD6580
    143144
     
    149150
    150151;--------------------------------------------------------------------
    151 ; Vision_InitializeWithIDinAHandConfigInAL
    152 ;   Parameters:
    153 ;       AL:     QD65xx Config Register contents
    154 ;       AH:     QDI Vision Controller ID (bits 4...7)
     152; Vision_InitializeWithIDinAH
     153;   Parameters:
     154;       AH:     QDI Vision Controller ID
    155155;       DS:DI:  Ptr to DPT for Single or Slave Drive
    156156;       SI:     Offset to Master DPT if Slave Drive present
     
    162162;       AX, BX, CX, DX, BP
    163163;--------------------------------------------------------------------
    164 Vision_InitializeWithIDinAHandConfigInAL:
     164Vision_InitializeWithIDinAH:
    165165    ; QD6580 has a Control Register that needs to be programmed
    166     cmp     ah, ID_QD6500 << 4
     166    cmp     ah, ID_QD6500
    167167    mov     dx, [di+DPT_ADVANCED_ATA.wControllerBasePort]
    168168    mov     bp, QD6500_MAX_ACTIVE_TIME_CLOCKS | (QD6500_MIN_ACTIVE_TIME_CLOCKS << 8)    ; Assume QD6500
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm

    r580 r589  
    8181    mov     al, [cs:ROMVARS.wFlags]         ; Configurator set to always scan?
    8282    or      al, [es:BDA.bKBFlgs1]           ; Or, did the user hold down the ALT key?
    83     and     al, 8                           ; 8 = alt key depressed, same as FLG_ROMVARS_SERIAL_ALWAYSDETECT
     83    and     al, 8                           ; 8 = alt key depressed, same as FLG_ROMVARS_SERIAL_SCANDETECT
    8484    jnz     .DriveDetectLoop
    8585%endif ; MODULE_SERIAL
     
    135135
    136136    shr     ch, 1                           ; number of drives, 1 or 2 only, to CF flag (clear=1, set=2)
    137     rcl     al, 1                           ; starting drive number in upper 7 bits, number of drives in low bit
     137    eRCL_IM al, 1                           ; starting drive number in upper 7 bits, number of drives in low bit
    138138.NoFloppies:
    139139    mov     [RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst], al
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm

    r568 r589  
    9090%ifdef MODULE_SERIAL
    9191    cmp     dh, DEVICE_SERIAL_PORT          ; Check if this is a serial device
    92 
    93     jnz     .pushAndPrint                   ; CX = string to print, AX = port address, DX won't be used
     92    jne     SHORT .pushAndPrint             ; CX = string to print, AX = port address, DX won't be used
    9493
    9594    mov     cl, (g_szDetectCOM-$$) & 0xff   ; Setup print string for COM ports
     
    106105
    107106    test    dl, dl                          ; Check if serial port "Auto"
    108     jz      .pushAndPrintSerial             ; CX = string to print, AX and DX won't be used
     107    jz      SHORT .pushAndPrintSerial       ; CX = string to print, AX and DX won't be used
    109108
    110109    mov     cl, (g_szDetectCOMLarge-$$) & 0xff  ; Setup secondary print string for "COMn/xx.yK"
    111110
    112     mov     al,ah                           ; baud rate divisor to AL
     111    mov     al, ah                          ; baud rate divisor to AL
    113112    cbw                                     ; clear AH, AL will always be less than 128
    114     xchg    si,ax                           ; move AX to SI for divide
    115     mov     ax,1152                         ; baud rate to display is 115200/divisor, the "00" is handled
     113    xchg    si, ax                          ; move AX to SI for divide
     114    mov     ax, 1152                        ; baud rate to display is 115200/divisor, the "00" is handled
    116115                                            ; in the print strings
    117116    cwd                                     ; clear top 16-bits of dividend
    118117    div     si                              ; and divide...  Now AX = baud rate/100, DX = 0 (always a clean divide)
    119118
    120     mov     si,10                           ; Now separate the whole portion from the fractional for "K" display
     119    mov     si, 10                          ; Now separate the whole portion from the fractional for "K" display
    121120    div     si                              ; and divide...  Now AX = baud rate/1000, DX = low order digit
    122121
    123     cmp     ax,si                           ; < 10: "2400", "9600", etc.; >= 10: "19.2K", "38.4K", etc.
    124     jae     .pushAndPrintSerial
     122    cmp     ax, si                          ; < 10: "2400", "9600", etc.; >= 10: "19.2K", "38.4K", etc.
     123    jae     SHORT .pushAndPrintSerial
    125124
    126125    mov     cl, (g_szDetectCOMSmall-$$) & 0xff  ; Setup secondary print string for "COMn/XXy00"
     
    150149DetectPrint_DriveNameFromDrvDetectInfoInESBX:
    151150    push    bp
    152     mov     bp,sp
    153     lea     si,[bx+DRVDETECTINFO.szDrvName]
     151    mov     bp, sp
     152    lea     si, [bx+DRVDETECTINFO.szDrvName]
    154153    push    si
    155     mov     si,g_szDriveName
     154    mov     si, g_szDriveName
    156155    jmp     SHORT DetectPrint_FormatCSSIfromParamsInSSBP
    157156
     
    276275;
    277276    push    bp
    278     mov     bp,sp
     277    mov     bp, sp
    279278    ; Fall to DetectPrint_FormatCSSIfromParamsInSSBP
    280279
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm

    r580 r589  
    240240    push    cx
    241241    xchg    ax, cx              ; IRQ index to CL
    242     mov     ch, 1               ; Load 1 to be shifted
    243     shl     ch, cl              ; Shift bit to correct position
    244     not     ch                  ; Invert to create bit mask for clearing
     242    mov     ch, ~1              ; Load bit mask to be rotated
     243    rol     ch, cl              ; Rotate mask to correct position for clearing
    245244    in      al, dx              ; Read Interrupt Mask Register
    246245    and     al, ch              ; Clear wanted bit
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r588 r589  
    117117
    118118%ifdef MODULE_SERIAL
    119     at  ROMVARS.ideVarsSerialAuto+IDEVARS.bDevice,      db  DEVICE_SERIAL_PORT
     119    at  ROMVARS.ideVarsSerialAuto+IDEVARS.bDevice,  db  DEVICE_SERIAL_PORT
    120120%endif
    121121%else
     
    134134    at  ROMVARS.bIdleTimeout,   db  0                       ; Standby timer disabled by default
    135135
    136 %ifdef MODULE_8BIT_IDE_ADVANCED
    137     at  ROMVARS.ideVars0+IDEVARS.wBasePort,             dw  DEVICE_XTIDE_DEFAULT_PORT       ; Controller Command Block base port
    138     at  ROMVARS.ideVars0+IDEVARS.bDevice,               db  DEVICE_8BIT_XTCF_PIO8
     136%ifndef MODULE_8BIT_IDE
     137    at  ROMVARS.ideVars0+IDEVARS.wBasePort,         dw  DEVICE_ATA_PRIMARY_PORT         ; Controller Command Block base port
     138    at  ROMVARS.ideVars0+IDEVARS.wControlBlockPort, dw  DEVICE_ATA_PRIMARY_PORTCTRL     ; Controller Control Block base port
     139    at  ROMVARS.ideVars0+IDEVARS.bDevice,           db  DEVICE_16BIT_ATA
     140%elifdef MODULE_8BIT_IDE_ADVANCED
     141    at  ROMVARS.ideVars0+IDEVARS.wBasePort,         dw  DEVICE_XTIDE_DEFAULT_PORT       ; Controller Command Block base port
     142    at  ROMVARS.ideVars0+IDEVARS.bDevice,           db  DEVICE_8BIT_XTCF_PIO8
    139143%else
    140     at  ROMVARS.ideVars0+IDEVARS.wBasePort,             dw  DEVICE_XTIDE_DEFAULT_PORT       ; Controller Command Block base port
    141     at  ROMVARS.ideVars0+IDEVARS.wControlBlockPort,     dw  DEVICE_XTIDE_DEFAULT_PORTCTRL   ; Controller Control Block base port
    142     at  ROMVARS.ideVars0+IDEVARS.bDevice,               db  DEVICE_8BIT_XTIDE_REV1
     144    at  ROMVARS.ideVars0+IDEVARS.wBasePort,         dw  DEVICE_XTIDE_DEFAULT_PORT       ; Controller Command Block base port
     145    at  ROMVARS.ideVars0+IDEVARS.wControlBlockPort, dw  DEVICE_XTIDE_DEFAULT_PORTCTRL   ; Controller Control Block base port
     146    at  ROMVARS.ideVars0+IDEVARS.bDevice,           db  DEVICE_8BIT_XTIDE_REV1
    143147%endif
    144148    at  ROMVARS.ideVars0+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    145149    at  ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    146150
     151    at  ROMVARS.ideVars1+IDEVARS.wBasePort,         dw  DEVICE_ATA_SECONDARY_PORT
     152    at  ROMVARS.ideVars1+IDEVARS.wControlBlockPort, dw  DEVICE_ATA_SECONDARY_PORTCTRL
     153    at  ROMVARS.ideVars1+IDEVARS.bDevice,           db  DEVICE_16BIT_ATA
    147154    at  ROMVARS.ideVars1+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    148155    at  ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    149156
     157    at  ROMVARS.ideVars2+IDEVARS.wBasePort,         dw  DEVICE_ATA_TERTIARY_PORT
     158    at  ROMVARS.ideVars2+IDEVARS.wControlBlockPort, dw  DEVICE_ATA_TERTIARY_PORTCTRL
     159    at  ROMVARS.ideVars2+IDEVARS.bDevice,           db  DEVICE_16BIT_ATA
    150160    at  ROMVARS.ideVars2+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    151161    at  ROMVARS.ideVars2+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    152162
     163    at  ROMVARS.ideVars3+IDEVARS.wBasePort,         dw  DEVICE_ATA_QUATERNARY_PORT
     164    at  ROMVARS.ideVars3+IDEVARS.wControlBlockPort, dw  DEVICE_ATA_QUATERNARY_PORTCTRL
     165    at  ROMVARS.ideVars3+IDEVARS.bDevice,           db  DEVICE_16BIT_ATA
    153166    at  ROMVARS.ideVars3+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    154167    at  ROMVARS.ideVars3+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION)
    155168
    156169%ifdef MODULE_SERIAL
    157     at  ROMVARS.ideVarsSerialAuto+IDEVARS.bDevice,      db  DEVICE_SERIAL_PORT
     170    at  ROMVARS.ideVarsSerialAuto+IDEVARS.bDevice,  db  DEVICE_SERIAL_PORT
    158171%endif
    159172%endif
     
    286299    %include "AH41h_CheckIfExtensionsPresent.asm"
    287300%endif
     301
     302
     303; Although it's very unlikely to happen, we give warnings for builds that cannot be automatically checksummed due to the size being too large.
     304; In some cases it's theoretically possible to checksum the build anyway (manually) which is why these are warnings and not errors.
     305%if BIOS_SIZE = 8192                ; A small build, possibly a candidate for the ROM socket on a 3Com 3C503 card.
     306    %if ($-$$) <= BIOS_SIZE         ; Only give warnings when the problem isn't obvious anyway.
     307        %if ($-$$) > BIOS_SIZE - 3
     308            %warning "This build is too large to be auto-checksummed!"
     309        %endif
     310    %endif
     311%elif ($-$$) = BIOS_SIZE            ; A large build.
     312    %warning "This build is too large to be auto-checksummed!"
     313%endif
  • trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuPrint.asm

    r583 r589  
    3939    mov     si, g_szRomBootDash                     ; Standard "Rom Boot" but with a "-" at the front
    4040    mov     al, 20h                                 ; The space between "Rom" and "Boot"
    41     jnc     .ROMBoot                                ; display "Rom Boot" option for last entry
     41    jnc     SHORT .ROMBoot                          ; display "Rom Boot" option for last entry
    4242
    4343    call    FindDPT_ForDriveNumberInDL
    44     jc      .notOurs
     44    jc      SHORT .notOurs
    4545
    4646    call    DriveDetectInfo_ConvertDPTtoBX
    4747    mov     si, g_szDriveNumBOOTNFO                 ; special g_szDriveNum that prints from BDA
    48     jmp     .go
     48    jmp     SHORT .go
    4949
    5050.notOurs:
    51     mov     si,g_szDriveNum
    52     mov     bx,g_szForeignHD                        ; assume a hard disk for the moment
     51    mov     si, g_szDriveNum
     52    mov     bx, g_szForeignHD                       ; assume a hard disk for the moment
    5353
    5454    test    dl, dl
    55     js      .go
    56     mov     bl,((g_szFloppyDrv)-$$ & 0xff)          ; and revisit the earlier assumption...
     55    js      SHORT .go
     56    mov     bl, ((g_szFloppyDrv)-$$ & 0xff)         ; and revisit the earlier assumption...
    5757
    5858.go:
     
    6060    call    DriveXlate_ToOrBack
    6161
    62     test    dl, 0f0h                                ; if there is a character in the upper nibble
    63     jnz     .noSpace
    64     dec     si                                      ; backup a character to a leading space
    65 .noSpace:
     62    cmp     dl, 10h                                 ; Check if there is a character in the upper nibble
     63    sbb     si, 0                                   ; If not, backup a character to a leading space
    6664
    6765    push    dx                                      ; translated drive number
     
    8684;--------------------------------------------------------------------
    8785BootMenuPrint_TitleStrings:
    88     xor     di,di                       ; Null character will be eaten
     86    xor     di, di                      ; Null character will be eaten
    8987    mov     si, g_szBootMenuTitle
    9088    jmp     DetectPrint_RomFoundAtSegment.BootMenuEntry
     
    105103
    106104    call    BootMenu_GetDriveToDXforMenuitemInCX
    107     jnc     BootMenuEvent_Completed                     ; nothing to display if "Rom Boot" option
     105    jnc     SHORT BootMenuEvent_Completed               ; nothing to display if "Rom Boot" option
    108106
    109107    push    bp
     
    116114    inc     dl                                          ; are we a hard disk?
    117115    dec     dl                                          ; inc/dec will set SF, without modifying CF or DL
    118     js      .HardDiskRefreshInformation
    119 
    120     jnc     .ours                                       ; Based on CF from FindDPT_ForDriveNumberInDL above
     116    js      SHORT .HardDiskRefreshInformation
     117
     118    jnc     SHORT .ours                                 ; Based on CF from FindDPT_ForDriveNumberInDL above
    121119    call    FloppyDrive_GetType                         ; Get Floppy Drive type to BX
    122     jmp     .around
     120    jmp     SHORT .around
    123121.ours:
    124122    call    AH8h_GetDriveParameters
     
    132130    cmp     bl, FLOPPY_TYPE_35_ED
    133131    ja      SHORT .PushAXAndOutput
    134 
    135132    ; Fall to .PrintKnownFloppyType
    136133
     
    162159    mov     al, (g_szFddThreeHalf - $$) & 0xff
    163160    cmp     bl, FLOPPY_TYPE_525_HD
    164     ja      .ThreeHalf
     161    ja      SHORT .ThreeHalf
    165162    mov     al, (g_szFddFiveQuarter - $$) & 0xff
    166163.ThreeHalf:
     
    168165
    169166    xor     bh, bh
    170     mov     al,FloppyTypes.rgbCapacityMultiplier
     167    mov     al, FloppyTypes.rgbCapacityMultiplier
    171168    mul     BYTE [cs:bx+FloppyTypes.rgbCapacity - 1]    ; -1 since 0 is handled above and not in the table
    172169
     
    184181;   Parameters:
    185182;       DS:     RAMVARS segment
     183;       DI:     Zero if foreign drive
     184;               Offset to DPT if our drive
     185;       CF:     Set if foreign drive
     186;               Clear if our drive
    186187;   Returns:
    187188;       CF:     Set since menu event was handled successfully
    188189;   Corrupts registers:
    189 ;       BX, CX, DX, SI, DI, ES
     190;       AX, BX, CX, DX, SI, DI, ES
    190191;--------------------------------------------------------------------
    191192.HardDiskRefreshInformation:
    192     jc      .HardDiskMenuitemInfoForForeignDrive        ; Based on CF from FindDPT_ForDriveNumberInDL (way) above
     193    jc      SHORT .HardDiskMenuitemInfoForForeignDrive  ; Based on CF from FindDPT_ForDriveNumberInDL (way) above
    193194
    194195.HardDiskMenuitemInfoForOurDrive:
    195196    ePUSH_T ax, g_szInformation                         ; Add substring for our hard disk information
    196     call    GetTotalSectorCount
    197     jmp     .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
     197
     198%ifdef MODULE_EBIOS
     199    ePUSH_T ax, .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
     200    test    BYTE [di+DPT.bFlagsLow], FLGL_DPT_LBA
     201%ifdef USE_386
     202    jnz     AccessDPT_GetLbaSectorCountToBXDXAX
     203    jmp     AH15h_GetSectorCountToBXDXAX
     204%else ; ~USE_386
     205    jz      SHORT .NoLBA
     206    jmp     AccessDPT_GetLbaSectorCountToBXDXAX
     207.NoLBA:
     208    jmp     AH15h_GetSectorCountToBXDXAX
     209%endif
     210%else ; ~MODULE_EBIOS
     211    call    AH15h_GetSectorCountToBXDXAX
     212    jmp     SHORT .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
     213%endif ; MODULE_EBIOS
    198214
    199215.HardDiskMenuitemInfoForForeignDrive:
     
    226242    db      2880  / FloppyTypes.rgbCapacityMultiplier    ;  type 5
    227243    db      2880  / FloppyTypes.rgbCapacityMultiplier    ;  type 6
    228 
    229 
    230 ;--------------------------------------------------------------------
    231 ; GetTotalSectorCount
    232 ;   Parameters:
    233 ;       DS:DI:      DPT Pointer
    234 ;   Returns:
    235 ;       BX:DX:AX:   48-bit sector count
    236 ;   Corrupts registers:
    237 ;       CX
    238 ;--------------------------------------------------------------------
    239 %ifdef MODULE_EBIOS
    240 GetTotalSectorCount     EQU     AccessDPT_GetLbaSectorCountToBXDXAX
    241 %else
    242 GetTotalSectorCount     EQU     AH15h_GetSectorCountToBXDXAX
    243 %endif
  • trunk/XTIDE_Universal_BIOS/Src/Strings.asm

    r588 r589  
    136136g_szDeviceTypeValues:
    137137g_szDeviceTypeValues_16bit:         db  " 16",NULL
     138%ifdef MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
    138139g_szDeviceTypeValues_32bit:         db  " 32",NULL
     140%ifdef MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
    139141g_szDeviceTypeValues_8bit:          db  "  8",NULL
    140142g_szDeviceTypeValues_XTIDEr1:       db  "D8 ",NULL  ; Dual 8-bit
    141143g_szDeviceTypeValues_XTIDEr2:       db  "X8 ",NULL  ; A0<->A3 swapped 8-bit
     144%ifdef MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
    142145g_szDeviceTypeValues_XTCFpio8:      db  "T8 ",NULL  ; True 8-bit
    143146g_szDeviceTypeValues_XTCFpio8BIU:   db  "T8B",NULL
     
    146149g_szDeviceTypeValues_JrIde:         db  "M8 ",NULL  ; Memory Mapped 8-bit
    147150g_szDeviceTypeValues_ADP50L:        db  "M8 ",NULL  ; Memory Mapped 8-bit
     151%ifdef MODULE_SERIAL
    148152g_szDeviceTypeValues_Serial:        db  "SER",NULL
    149 
    150 g_szDeviceTypeValues_Displacement equ (g_szDeviceTypeValues_32bit - g_szDeviceTypeValues)
     153%endif ; MODULE_SERIAL
     154%endif ; MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     155%endif ; MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     156%endif ; MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     157
     158g_szDeviceTypeValues_Displacement equ 3     ; 3 compressed, 4 uncompressed
     159;g_szDeviceTypeValues_Displacement equ (g_szDeviceTypeValues_32bit - g_szDeviceTypeValues)
    151160;
    152161; Ensure that device type strings are correctly spaced in memory
     
    156165        %error "g_szDeviceTypeValues Displacement Incorrect 1"
    157166    %endif
     167
     168    %ifdef MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     169
    158170    %if g_szDeviceTypeValues_32bit <> g_szDeviceTypeValues_16bit + g_szDeviceTypeValues_Displacement
    159171        %error "g_szDeviceTypeValues Displacement Incorrect 2"
    160172    %endif
     173
     174    %ifdef MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     175
    161176    %if g_szDeviceTypeValues_8bit <> g_szDeviceTypeValues_32bit + g_szDeviceTypeValues_Displacement
    162177        %error "g_szDeviceTypeValues Displacement Incorrect 3"
     
    168183        %error "g_szDeviceTypeValues Displacement Incorrect 5"
    169184    %endif
     185
     186    %ifdef MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     187
    170188    %if g_szDeviceTypeValues_XTCFpio8 <> g_szDeviceTypeValues_XTIDEr2 + g_szDeviceTypeValues_Displacement
    171189        %error "g_szDeviceTypeValues Displacement Incorrect 6"
     
    186204        %error "g_szDeviceTypeValues Displacement Incorrect 11"
    187205    %endif
     206
     207    %ifdef MODULE_SERIAL
     208
    188209    %if g_szDeviceTypeValues_Serial <> g_szDeviceTypeValues_ADP50L + g_szDeviceTypeValues_Displacement
    189210        %error "g_szDeviceTypeValues Displacement Incorrect 12"
    190211    %endif
     212
     213    %endif ; MODULE_SERIAL
     214    %endif ; MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     215    %endif ; MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     216    %endif ; MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     217
    191218%endif
    192219
  • trunk/XTIDE_Universal_BIOS/Src/StringsCompressed.asm

    r588 r589  
    257257                                      db     20h,  2bh,  0fh          ; compressed
    258258
     259%ifdef MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
    259260g_szDeviceTypeValues_32bit:         ; db    " 32",NULL
    260261                                    ; db     20h,  33h,  32h,  00h    ; uncompressed
    261262                                      db     20h,  2dh,  0ch          ; compressed
    262263
     264%ifdef MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
    263265g_szDeviceTypeValues_8bit:          ; db    "  8",NULL
    264266                                    ; db     20h,  20h,  38h,  00h    ; uncompressed
     
    273275                                      db     5eh,  30h,  00h          ; compressed
    274276
     277%ifdef MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
    275278g_szDeviceTypeValues_XTCFpio8:      ; db    "T8 ",NULL  ; True 8-bit
    276279                                    ; db     54h,  38h,  20h,  00h    ; uncompressed
     
    297300                                      db     53h,  30h,  00h          ; compressed
    298301
     302%ifdef MODULE_SERIAL
    299303g_szDeviceTypeValues_Serial:        ; db    "SER",NULL
    300304                                    ; db     53h,  45h,  52h,  00h    ; uncompressed
    301305                                      db     59h,  4bh,  98h          ; compressed
    302306
    303 
    304 g_szDeviceTypeValues_Displacement equ (g_szDeviceTypeValues_32bit - g_szDeviceTypeValues)
     307%endif ; MODULE_SERIAL
     308%endif ; MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     309%endif ; MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     310%endif ; MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     311
     312g_szDeviceTypeValues_Displacement equ 3     ; 3 compressed, 4 uncompressed
     313;g_szDeviceTypeValues_Displacement equ (g_szDeviceTypeValues_32bit - g_szDeviceTypeValues)
    305314;
    306315; Ensure that device type strings are correctly spaced in memory
     
    310319%error "g_szDeviceTypeValues Displacement Incorrect 1"
    311320%endif
     321
     322%ifdef MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     323
    312324%if g_szDeviceTypeValues_32bit <> g_szDeviceTypeValues_16bit + g_szDeviceTypeValues_Displacement
    313325%error "g_szDeviceTypeValues Displacement Incorrect 2"
    314326%endif
     327
     328%ifdef MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     329
    315330%if g_szDeviceTypeValues_8bit <> g_szDeviceTypeValues_32bit + g_szDeviceTypeValues_Displacement
    316331%error "g_szDeviceTypeValues Displacement Incorrect 3"
     
    322337%error "g_szDeviceTypeValues Displacement Incorrect 5"
    323338%endif
     339
     340%ifdef MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     341
    324342%if g_szDeviceTypeValues_XTCFpio8 <> g_szDeviceTypeValues_XTIDEr2 + g_szDeviceTypeValues_Displacement
    325343%error "g_szDeviceTypeValues Displacement Incorrect 6"
     
    340358%error "g_szDeviceTypeValues Displacement Incorrect 11"
    341359%endif
     360
     361%ifdef MODULE_SERIAL
     362
    342363%if g_szDeviceTypeValues_Serial <> g_szDeviceTypeValues_ADP50L + g_szDeviceTypeValues_Displacement
    343364%error "g_szDeviceTypeValues Displacement Incorrect 12"
    344365%endif
     366
     367%endif ; MODULE_SERIAL
     368%endif ; MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     369%endif ; MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     370%endif ; MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
     371
    345372%endif
    346373
     
    567594
    568595;; translated usage stats
    569 ;; 172:2
    570 ;; 47:2
    571 ;; 171:2
    572 ;; 46:3
    573 ;; 48:2
    574 ;; 181:1
    575 ;; 200:1
    576 ;; 54:2
    577 ;; 45:2
    578 ;; 49:2
    579596;; 34:3
    580597;; 179:8
    581 ;; 56:8
     598;; 46:3
     599;; 44:1
     600;; 200:1
     601;; 48:2
     602;; 175:1
     603;; 171:2
     604;; 51:3
     605;; 50:2
    582606;; 33:1
    583607;; 53:2
     608;; 45:2
     609;; 47:2
     610;; 172:2
     611;; 56:8
    584612;; 32:34
    585 ;; 175:1
    586 ;; 44:1
    587 ;; 50:2
    588 ;; 51:3
     613;; 181:1
     614;; 54:2
     615;; 49:2
    589616;; total translated: 20
    590617
    591618;; format usage stats
    592 ;; z:2
     619;; 5-x:1
     620;; 2-u:1
     621;; s:14
    593622;; nl:12
    594 ;; u:6
    595 ;; 5-x:1
    596 ;; c:13
    597623;; A:4
    598 ;; s:14
    599624;; 5-u:2
    600625;; x:5
    601 ;; 2-u:1
    602626;; 2-I:1
     627;; z:2
     628;; u:6
     629;; c:13
    603630;; total format: 11
    604631
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm

    r588 r589  
    6262
    6363    jnz     SHORT .EnableDeviceIrq
    64     or      al, FLG_DEVCONTROL_nIEN ; Disable IRQ
     64    mov     al, FLG_DEVCONTROL_nIEN ; Disable IRQ
    6565.EnableDeviceIrq:
    6666%else
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CompatibleDPT.asm

    r568 r589  
    231231
    232232    xor     dl, dl                          ; Clear DL for checksum
     233    push    bp
     234    mov     bp, StoswThenAddALandAHtoDL
    233235
    234236    ; DPTE.wBasePort
    235237    mov     ax, [si+DPT.wBasePort]
    236     call    StoswThenAddALandAHtoDL         ; Bytes 0 and 1
     238    call    bp                              ; Bytes 0 and 1
    237239
    238240    ; DPTE.wControlBlockPort
    239241    eMOVZX  bx, [si+DPT.bIdevarsOffset]
    240242    mov     ax, [cs:bx+IDEVARS.wControlBlockPort]
    241     call    StoswThenAddALandAHtoDL         ; Bytes 2 and 3
     243    call    bp                              ; Bytes 2 and 3
    242244
    243245    ; DPTE.bDrvnhead and DPTE.bBiosVendor
     
    245247    call    AccessDPT_GetDriveSelectByteToAL
    246248    xchg    si, di
    247     call    StoswThenAddALandAHtoDL         ; Bytes 4 and 5
     249    call    bp                              ; Bytes 4 and 5
    248250
    249251    ; DPTE.bIRQ and DPTE.bBlockSize
    250252    mov     al, [cs:bx+IDEVARS.bIRQ]        ; No way to define that we might not use IRQ
    251     mov     ah, [si+DPT_ATA.bBlockSize]
    252     cmp     ah, 1
    253     jbe     SHORT .DoNotSetBlockModeFlag
     253    mov     ah, [si+DPT_ATA.bBlockSize]     ; DPT_ATA.bBlockSize must never be zero!
     254    sahf                                    ; Only block size = 1 sets CF
     255    jc      SHORT .DoNotSetBlockModeFlag
    254256    or      cl, FLG_BLOCK_MODE_ENABLED
    255257.DoNotSetBlockModeFlag:
    256     call    StoswThenAddALandAHtoDL         ; Bytes 6 and 7
     258    call    bp                              ; Bytes 6 and 7
    257259
    258260    ; DPTE.bDmaChannelAndType and DPTE.bPioMode
     
    266268    sbb     cl, -1  ; FLG_FAST_PIO_ENABLED (if .wControllerID > 0)
    267269.DoNotSetFastPioFlag:
    268     call    StoswThenAddALandAHtoDL         ; Bytes 8 and 9
     270    call    bp                              ; Bytes 8 and 9
    269271%endif
    270272
     
    279281.NoChsTranslationOrBitShiftTranslationSet:
    280282    xchg    ax, cx
    281     call    StoswThenAddALandAHtoDL         ; Bytes 10 and 11
     283    call    bp                              ; Bytes 10 and 11
     284    pop     bp
    282285
    283286    ; DPTE.wReserved (must be zero)
  • trunk/XTIDE_Universal_BIOS/makefile

    r580 r589  
    1818# MODULE_8BIT_IDE             Support for 8-BIT IDE cards like XTIDE                               #
    1919# MODULE_8BIT_IDE_ADVANCED    Support for memory mapped and DMA based cards like JRIDE and XTCF    #
    20 # MODULE_ADVANCED_ATA         Native support for some VLB IDE controllers                          #
     20# MODULE_ADVANCED_ATA         Native support for some VLB IDE controllers (requires USE_386)       #
    2121# MODULE_COMPATIBLE_TABLES    Support for ill behaving software that tries to access DPT directly  #
    2222# MODULE_BOOT_MENU            Boot Menu for selection of drive to boot from                        #
     
    108108DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE_ADVANCED
    109109DEFINES_XTPLUS = $(DEFINES_XT) USE_186
    110 DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 MODULE_IRQ MODULE_ADVANCED_ATA MODULE_COMPATIBLE_TABLES
     110DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 MODULE_IRQ MODULE_COMPATIBLE_TABLES
    111111
    112112DEFINES_XT_LARGE = $(DEFINES_XT) $(DEFINES_COMMON_LARGE)
     
    115115
    116116DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED MODULE_8BIT_IDE NO_ATAID_VALIDATION
    117 DEFINES_386_8K = $(DEFINES_AT) USE_386
     117DEFINES_386_8K = $(DEFINES_AT) USE_386 MODULE_ADVANCED_ATA
    118118
    119119DEFINES_ALL_FEATURES = MODULE_8BIT_IDE MODULE_8BIT_IDE_ADVANCED MODULE_ADVANCED_ATA MODULE_EBIOS MODULE_BOOT_MENU MODULE_HOTKEYS MODULE_IRQ MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_STRINGS_COMPRESSED MODULE_POWER_MANAGEMENT MODULE_COMPATIBLE_TABLES
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/BiosFile.asm

    r526 r589  
    7575
    7676    cmp     dx, MAX_EEPROM_SIZE_IN_BYTES >> 16
     77    jb      SHORT .FileNotTooBig
    7778    ja      SHORT .FileTooBig
    78     jb      SHORT .FileNotTooBig
    7979    cmp     ax, MAX_EEPROM_SIZE_IN_BYTES & 0FFFFh
    8080    ja      SHORT .FileTooBig
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Buffers.asm

    r567 r589  
    214214    call    Buffers_GetFileBufferToESDI
    215215    call    EEPROM_GetXtideUniversalBiosSizeFromESDItoDXCX
    216     dec     cx              ; Leave space for checksum byte
    217     xor     ax, ax
    218 ALIGN JUMP_ALIGN
     216
     217; Compatibility fix for 3Com 3C503 cards where the ASIC returns 8080h as the last two bytes of the ROM.
     218
     219    ; Assume the BIOS size is not 8K, ie generate a normal checksum.
     220    dec     cx
     221    mov     ax, 100h
     222    cmp     cx, 8192 - 1
     223    jne     SHORT .BiosSizeIsNot8K
     224    ; The BIOS size is 8K and therefore a potential candidate for a 3Com 3C503 card.
     225    dec     cx
     226    dec     cx
     227    mov     ah, 3
     228ALIGN JUMP_ALIGN
     229.BiosSizeIsNot8K:
    219230.SumNextByte:
    220231    add     al, [es:di]
     232.NextChecksumByte:
    221233    inc     di
    222234    loop    .SumNextByte
    223235    neg     al
    224236    mov     [es:di], al
     237    inc     cx
     238    dec     ah
     239    jnz     SHORT .NextChecksumByte
    225240
    226241    pop     dx
     
    271286;       ES:DI:  Ptr to file buffer
    272287;   Corrupts registers:
    273 ;       AX
     288;       Nothing
    274289;--------------------------------------------------------------------
    275290ALIGN JUMP_ALIGN
    276291Buffers_GetIdeControllerCountToCX:
    277     call    Buffers_GetFileBufferToESDI
    278     mov     al, [es:di+ROMVARS.bIdeCnt]
    279 
    280     ; Limit controller count for lite mode
     292    xor     cx, cx
     293    call    Buffers_GetFileBufferToESDI
     294    or      cl, [es:di+ROMVARS.bIdeCnt]
     295    jnz     SHORT .LimitControllerCountForLiteMode
     296    inc     cx              ; Make sure there is at least one controller
     297
     298.LimitControllerCountForLiteMode:
    281299    test    BYTE [es:di+ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
    282300    jnz     SHORT .ReturnControllerCountInCX
    283     MIN_U   al, MAX_LITE_MODE_CONTROLLERS
     301    MIN_U   cl, MAX_LITE_MODE_CONTROLLERS
    284302
    285303.ReturnControllerCountInCX:
    286     cbw     ; A maximum of 127 controllers should be sufficient
    287     xchg    cx, ax
    288304    ret
    289305
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/EEPROM.asm

    r568 r589  
    8181    mov     cl, dl
    8282    eSHL_IM ch, 1
     83    eRCL_IM dl, 1
    8384    ret
    8485
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/IdeAutodetect.asm

    r567 r589  
    5656DetectMemoryMappedDeviceFromSegmentDX:
    5757    ; *** Try to detect JR-IDE/ISA and ADP50L (only if MODULE_8BIT_IDE_ADVANCED is present) ***
    58     test    WORD [di+ROMVARS.wFlags], FLG_ROMVARS_MODULE_8BIT_IDE_ADVANCED
     58    test    BYTE [di+ROMVARS.wFlags], FLG_ROMVARS_MODULE_8BIT_IDE_ADVANCED
    5959    stc
    6060    jz      SHORT .NoIdeDeviceFound
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Main.asm

    r554 r589  
    7676ALIGN JUMP_ALIGN
    7777Main_Start:
     78    mov     ah, GET_DOS_VERSION
     79    int     DOS_INTERRUPT_21h
     80    cmp     al, 2
     81    jae     SHORT .DosVersionIsOK
     82    mov     dx, g_s$NotMinimumDosVersion
     83    mov     ah, WRITE_STRING_TO_STANDARD_OUTPUT
     84    int     DOS_INTERRUPT_21h
     85    ret
     86.DosVersionIsOK:
     87
    7888    mov     ax, SCREEN_BACKGROUND_CHARACTER_AND_ATTRIBUTE
    79     call    InitializeScreenWithBackgroudCharAndAttrInAX
     89    call    InitializeScreenWithBackgroundCharAndAttrInAX
    8090
    8191    call    Main_InitializeCfgVars
    8292    call    MenuEvents_DisplayMenu
    8393    mov     ax, DOS_BACKGROUND_CHARACTER_AND_ATTRIBUTE
    84     call    InitializeScreenWithBackgroudCharAndAttrInAX
     94    call    InitializeScreenWithBackgroundCharAndAttrInAX
    8595
    8696    ; Exit to DOS
    87     mov     ax, 4C00h           ; Exit to DOS
    88     int     21h
     97    mov     ax, TERMINATE_WITH_RETURN_CODE<<8       ; Errorlevel 0 in AL
     98    int     DOS_INTERRUPT_21h
    8999
    90100
    91101;--------------------------------------------------------------------
    92 ; InitializeScreenWithBackgroudCharAndAttrInAX
     102; InitializeScreenWithBackgroundCharAndAttrInAX
    93103;   Parameters:
    94104;       AL:     Background character
     
    100110;--------------------------------------------------------------------
    101111ALIGN JUMP_ALIGN
    102 InitializeScreenWithBackgroudCharAndAttrInAX:
     112InitializeScreenWithBackgroundCharAndAttrInAX:
    103113    xchg    dx, ax
    104114    CALL_DISPLAY_LIBRARY InitializeDisplayContext   ; Reset cursor etc
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/MenuitemPrint.asm

    r526 r589  
    156156; MenuitemPrint_WriteLookupValueStringToBufferInESDIfromUnshiftedItemInDSSI
    157157; MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI
     158; MenuitemPrint_WriteLookupValueStringToBufferInESDIfromRawItemInDSSI
    158159;   Parameters:
    159160;       DS:SI:  Ptr to MENUITEM
     
    177178
    178179;--------------------------------------------------------------------
    179 ; MenuitemPrint_WriteLookupValueStringToBufferInESDIfromItemInDSSI
     180; PrintLookupValueFromAXtoBufferInESDI
    180181;   Parameters:
    181182;       AX:     Value to print
     
    190191PrintLookupValueFromAXtoBufferInESDI:
    191192    push    si
    192     test    byte [si+MENUITEM.bFlags], FLG_MENUITEM_CHOICESTRINGS
    193     jnz     .lookupChoice
     193    test    BYTE [si+MENUITEM.bFlags], FLG_MENUITEM_CHOICESTRINGS
     194    jnz     SHORT .LookupChoice
    194195
    195196    add     ax, [si+MENUITEM.itemValue+ITEM_VALUE.rgszValueToStringLookup]
    196197    xchg    bx, ax
    197 .found:
     198.Found:
    198199    mov     si, [bx]
    199 .errorReturn:
     200.ErrorReturn:
    200201    call    String_CopyDSSItoESDIandGetLengthToCX
    201202    pop     si
     
    212213; value could be zero, we don't use the .rgwChoiceToValueLookup array to find the end.
    213214;
    214 .lookupChoice:
    215     mov     bx,[si+MENUITEM.itemValue+ITEM_VALUE.rgszChoiceToStringLookup]
    216     mov     si,[si+MENUITEM.itemValue+ITEM_VALUE.rgwChoiceToValueLookup]
    217 
    218 .wordLoop:
    219     cmp     ax,[si]
    220     jz      .found
     215.LookupChoice:
     216    mov     bx, [si+MENUITEM.itemValue+ITEM_VALUE.rgszChoiceToStringLookup]
     217    mov     si, [si+MENUITEM.itemValue+ITEM_VALUE.rgwChoiceToValueLookup]
     218
     219.WordLoop:
     220    cmp     ax, [si]
     221    je      SHORT .Found
    221222    inc     bx
    222223    inc     bx
    223224    inc     si
    224225    inc     si
    225     cmp     word [bx],0
    226     jnz     .wordLoop
    227 
    228     mov     si,g_szValueUnknownError
    229     jmp     .errorReturn
     226    cmp     WORD [bx], 0
     227    jne     SHORT .WordLoop
     228
     229    mov     si, g_szValueUnknownError
     230    jmp     SHORT .ErrorReturn
    230231
    231232;--------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/ConfigurationMenu.asm

    r567 r589  
    177177        %assign i i+1
    178178    %endrep
    179     ;   dw  NULL    ; Is this needed? *FIXME*
     179        dw  NULL
     180
    180181
    181182; Section containing code
     
    285286    call    Buffers_GetRomvarsFlagsToAX
    286287    mov     bx, g_MenuitemConfigurationIdleTimeout
    287     test    ax, FLG_ROMVARS_MODULE_POWER_MANAGEMENT
     288    test    al, FLG_ROMVARS_MODULE_POWER_MANAGEMENT
    288289    jz      SHORT .DisableMenuitemFromCSBX
    289290    ; Fall to .EnableMenuitemFromCSBX
     
    393394    push    es
    394395    pop     ds
    395     xor     ch, ch                      ; clearing high order of CX and notification flag
    396     mov     dx, cx                      ; (probably unnecessary, CX should be less than 127, but just to be sure)
    397     jcxz    .done                       ; probably unnecessary, but make sure there is at least one controller
     396    mov     dx, cx                      ; Controller count to DL (will always be at least 1) while also clearing notification flag in DH
    398397
    399398    lea     bx, [di+ROMVARS.ideVars0]   ; add in offset of first idevars
     
    404403    xor     ax, ax                      ; first non-serial found
    405404    mov     cl, dl                      ; idevars count
    406     xor     ch, ch
    407405
    408406.loop:
    409     cmp     byte [di+IDEVARS.bDevice], DEVICE_SERIAL_PORT
    410     jnz     .notSerial
     407    cmp     BYTE [di+IDEVARS.bDevice], DEVICE_SERIAL_PORT
     408    jne     SHORT .notSerial
    411409
    412410    test    si, si                      ; record the first serial controller that we find
    413     jnz     .next
     411    jnz     SHORT .next
    414412    mov     si, di
    415413    SKIP2B  f
     
    423421
    424422    test    si, si                      ; no serial drives, nothing to do
    425     jz      .done
     423    jz      SHORT .done
    426424    cmp     si, ax                      ; serial port is already later on the list than any other controllers
    427     ja      .done                       ; (also takes care of the case where there are no other controllers)
     425    ja      SHORT .done                 ; (also takes care of the case where there are no other controllers)
    428426
    429427;
     
    438436    mov     di, sp
    439437
    440     mov     cx, IDEVARS_size
    441438    push    ss
    442439    pop     es
    443440
     441%if IDEVARS_size & 1
     442    mov     cl, IDEVARS_size
    444443    rep movsb
     444%else
     445    mov     cl, IDEVARS_size / 2
     446    rep movsw
     447%endif
    445448
    446449    lea     di, [si-IDEVARS_size]       ; move up all the idevars below the serial, by one slot
     
    457460    push    ss
    458461    pop     ds
    459     mov     cx, IDEVARS_size
    460462    ; di is already at last IDEVARS position
    461463
     464%if IDEVARS_size & 1
     465    mov     cl, IDEVARS_size
    462466    rep movsb
     467%else
     468    mov     cl, IDEVARS_size / 2
     469    rep movsw
     470%endif
    463471
    464472    add     sp, IDEVARS_size
     
    469477    mov     dh, 1                       ; set flag that we have done a relocation
    470478
    471     jmp     .outerLoop
     479    jmp     SHORT .outerLoop
    472480
    473481.done:
     
    478486
    479487    test    dh, dh
    480     jz      .noWorkDone
     488    jz      SHORT .noWorkDone
    481489
    482490    mov     dx, g_szSerialMoved
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/FlashMenu.asm

    r568 r589  
    328328    call    .GetSelectedEepromSizeInWordsToAX
    329329    xor     dx, dx
    330     shl     ax, 1       ; Size in bytes to...
    331     rcl     dx, 1       ; ...DX:AX
     330    eSHL_IM ax, 1       ; Size in bytes to...
     331    eRCL_IM dx, 1       ; ...DX:AX
    332332
    333333    cmp     WORD [si+FLASHVARS.wEepromPageSize], BYTE 1
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/IdeControllerMenu.asm

    r588 r589  
    571571
    572572
    573 ;
    574 ; No change to Device byte, but use this opportunity to change defaults stored in wPort and wPortCtrl if we are
    575 ; changing in/out of a Serial device (since we use these bytes in radically different ways).
    576 ;
    577573ALIGN JUMP_ALIGN
    578574IdeControllerMenu_WriteDevice:
     
    581577    push    ax
    582578
     579    mov     bl, [es:di]                         ; What is the current Device we are changing from?
     580    sub     di, BYTE IDEVARS.bDevice - IDEVARS.wBasePort    ; Get ready to set the Port addresses
     581
    583582    ; Note! AL is the choice index, not device code
    584     shl     ax, 1                               ; Selection to device code
    585     mov     bl, [es:di]                         ; what is the current Device we are changing from?
    586     sub     di, BYTE IDEVARS.bDevice - IDEVARS.wBasePort    ; Get ready to set the Port addresses
     583    shl     al, 1                               ; Selection to device code
     584
     585    ; Restore ports and other stuff to default values
     586    jz      SHORT .StandardIdeDevice            ; DEVICE_16BIT_ATA
     587
     588    cmp     al, DEVICE_8BIT_ATA
     589    ja      SHORT .NotStandardIdeDevice
     590    jb      SHORT .AdvancedAtaDevice            ; DEVICE_32BIT_ATA
     591    test    BYTE [es:ROMVARS.wFlags], FLG_ROMVARS_MODULE_8BIT_IDE
     592    jmp     SHORT .CheckZF
     593
     594.AdvancedAtaDevice:
     595    test    BYTE [es:ROMVARS.wFlags+1], FLG_ROMVARS_MODULE_ADVANCED_ATA >> 8
     596.CheckZF:
     597    jz      SHORT .SupportForDeviceNotAvailable
     598
     599    ; Standard ATA controllers, including 8-bit mode
     600.StandardIdeDevice:
     601    lea     ax, [di-ROMVARS.ideVars0+IDEVARS.wBasePort]
     602    mov     bl, IDEVARS_size
     603    div     bl
     604    mov     bx, .rgbLowByteOfStdIdeInterfacePorts
     605    xlat
     606    mov     ah, 1                               ; DEVICE_ATA_*_PORT >> 8
     607    mov     bh, 3                               ; DEVICE_ATA_*_PORTCTRL >> 8
     608    mov     bl, al
     609    jmp     SHORT .WriteNonSerial
     610
     611.rgbLowByteOfStdIdeInterfacePorts:              ; Defaults for 16-bit and better ATA devices
     612    db      DEVICE_ATA_PRIMARY_PORT     & 0FFh
     613    db      DEVICE_ATA_SECONDARY_PORT   & 0FFh
     614    db      DEVICE_ATA_TERTIARY_PORT    & 0FFh
     615    db      DEVICE_ATA_QUATERNARY_PORT  & 0FFh
     616
     617.NotStandardIdeDevice:
    587618    cmp     al, DEVICE_SERIAL_PORT
    588     je      SHORT .ChangingToSerial
     619    jb      SHORT .NotSerialDevice
     620    test    BYTE [es:ROMVARS.wFlags+1], FLG_ROMVARS_MODULE_SERIAL >> 8
     621    jnz     SHORT .ChangingToSerial
     622
     623.SupportForDeviceNotAvailable:
     624    push    dx
     625    mov     dx, g_szUnsupportedDevice
     626    call    Dialogs_DisplayErrorFromCSDX
     627    pop     dx
     628
     629    ; Restore device type to the previous value
     630    pop     ax                                  ; Get choice index from stack
     631    mov     al, bl                              ; Previous device type to AL
     632    shr     al, 1                               ; Device code to choice index
     633    jmp     SHORT .DoneWithNoChangeOfDevice
     634
     635.NotSerialDevice:
     636    ; Remaining device types all require MODULE_8BIT_IDE or MODULE_8BIT_IDE_ADVANCED
     637    test    BYTE [es:ROMVARS.wFlags], FLG_ROMVARS_MODULE_8BIT_IDE | FLG_ROMVARS_MODULE_8BIT_IDE_ADVANCED
     638    jz      SHORT .SupportForDeviceNotAvailable
     639
     640    ; We know MODULE_8BIT_IDE is included
     641    lahf    ; Save the PF
     642    cmp     al, DEVICE_8BIT_XTIDE_REV2
     643    jbe     SHORT .ChangingToXTIDEorXTCF
     644    sahf    ; Restore the PF
     645    jpo     SHORT .SupportForDeviceNotAvailable ; Jump if no MODULE_8BIT_IDE_ADVANCED
    589646    cmp     al, DEVICE_8BIT_JRIDE_ISA
    590647    je      SHORT .ChangingToJrIdeIsa
     
    592649    je      SHORT .ChangingToADP50L
    593650
    594     ; Restore ports to default values
    595     cmp     al, DEVICE_8BIT_ATA                 ; Standard ATA controllers, including 8-bit mode
    596     mov     ax, DEVICE_ATA_PRIMARY_PORT         ; Defaults for 16-bit and better ATA devices
    597     mov     bx, DEVICE_ATA_PRIMARY_PORTCTRL
    598     jbe     SHORT .WriteNonSerial
    599 
     651.ChangingToXTIDEorXTCF:
    600652    mov     ax, DEVICE_XTIDE_DEFAULT_PORT       ; Defaults for 8-bit XTIDE and XT-CF devices
    601653    mov     bx, DEVICE_XTIDE_DEFAULT_PORTCTRL
     
    631683.Done:
    632684    pop     ax
     685.DoneWithNoChangeOfDevice:
    633686    pop     di          ; IDEVARS.bDevice
    634687    pop     bx
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Strings.asm

    r588 r589  
    2121SECTION .data
    2222
     23; DOS version check
     24g_s$NotMinimumDosVersion:           db  LF,"This program requires DOS version 2 or higher.",LF,"$"
     25
    2326; Menu title
    2427g_szProgramTitle:                   db  "Configuration and Flashing program for XTIDE Universal BIOS v2.0.0.",LF,CR,NULL
    25 g_szXtideUniversalBiosSignature:    db  "XTIDE205",NULL
     28g_szXtideUniversalBiosSignature:    db  FLASH_SIGNATURE,NULL
    2629g_szBiosIsNotLoaded:                db  "BIOS is not loaded!",NULL
    2730g_szEEPROM:                         db  "EEPROM",NULL
     
    134137                        db  " Conventional memory. This makes it possible to use ROM BASIC and other software that requires"
    135138                        db  " the interrupt vectors where XTIDE Universal BIOS parameters would be stored in Lite mode.",LF,LF
    136                         db  "Lite mode supports only one IDE controller (2 drives) and stores parameters to the top of the interrupt vectors"
     139                        db  "Lite mode supports only 2 IDE controllers (4 drives) and stores parameters to the top of the interrupt vectors"
    137140                        db  " (30:0h) so no Conventional memory needs to be reserved. Lite mode cannot be used if some software requires"
    138141                        db  " the top of interrupt vectors. Usually this is not a problem since only IBM ROM BASIC uses them.",LF,LF
     
    221224g_szDlgIdeEnIRQ:            db  "Enable interrupt?",NULL
    222225g_szDlgIdeIRQ:              db  "Enter IRQ channel (2...7 for 8-bit controllers, 2...15 for any other controller).",NULL
     226g_szUnsupportedDevice:      db  "There is no support for this device type in the currently loaded BIOS."
     227                            db  " You must load a BIOS built with the proper module included to be able to use this type of device.",NULL
    223228
    224229g_szNfoIdeBackToCfgMenu:    db  "Back to XTIDE Universal BIOS Configuration Menu.",NULL
     
    275280                            db  "XTIDE rev 1",LF
    276281                            db  "XTIDE rev 2 or modded rev 1",LF
    277                             db  "XT-CF (PIO8)",LF
    278                             db  "XT-CF (PIO8 w/BIU offload)",LF
    279                             db  "XT-CF (PIO16 w/BIU offload)",LF
     282                            db  "XT-CF PIO8",LF
     283                            db  "XT-CF PIO8 (BIU offload)",LF
     284                            db  "XT-CF PIO16 (BIU offload)",LF
    280285                            db  "XT-CF DMA (v3 only)",LF
    281286                            db  "JR-IDE/ISA",LF
Note: See TracChangeset for help on using the changeset viewer.