Changeset 294 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src


Ignore:
Timestamp:
Mar 4, 2012, 1:35:10 AM (13 years ago)
Author:
krille_n_@…
google:author:
krille_n_@hotmail.com
Message:

Commit 2/2 (BIOS):

  • Fixed a bug in AH1h_HStatus.asm.
  • Minor optimizations.
  • Fixed spelling and did some cleaning.
Location:
trunk/XTIDE_Universal_BIOS/Src
Files:
43 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenu.asm

    r258 r294  
    4343    call    RamVars_GetSegmentToDS
    4444;;; fall-through
    45                        
     45
    4646ALIGN JUMP_ALIGN
    4747BootMenu_GetDriveToDXforMenuitemInCX:
     
    136136BootMenu_GetMenuitemToAXforAsciiHotkeyInAL:
    137137    call    Char_ALtoUpperCaseLetter
    138     xor     ah, ah
     138    cbw
    139139    xchg    ax, cx
    140140    call    BootMenu_GetLetterForFirstHardDiskToAL
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm

    r262 r294  
    77;--------------------------------------------------------------------
    88; BootMenuPrint_RefreshItem
    9 ; 
     9;
    1010;   Parameters:
    1111;       DL:     Untranslated Floppy Drive number
     
    1919    call    BootMenu_GetDriveToDXforMenuitemInCX_And_RamVars_GetSegmentToDS
    2020    jnc     BootMenuEvent_EventCompleted            ; if no menu item selected, out we go
    21        
     21
    2222    push    bp
    2323    mov     bp, sp
     
    2929    mov     si, g_szDriveNumBOOTNFO                 ; special g_szDriveNum that prints from BDA
    3030    jmp     .go
    31        
     31
    3232.notOurs:
    33     mov     si,g_szDriveNum                                 
     33    mov     si,g_szDriveNum
    3434    mov     bx,g_szForeignHD                        ; assume a hard disk for the moment
    35        
    36     test    dl,80h                                         
     35
     36    test    dl, dl
    3737    js      .go
    3838    mov     bl,((g_szFloppyDrv)-$$ & 0xff)          ; and revisit the earlier assumption...
    39        
     39
    4040.go:
    4141    mov     ax, dx                                  ; preserve DL for the floppy drive letter addition
     
    4545    add     al, 'A'                                 ; floppy drive letter (we always push this although
    4646    push    ax                                      ; the hard disks don't ever use it, but it does no harm)
    47        
     47
    4848    jmp     short BootMenuPrint_RefreshInformation.FormatRelay
    4949
     
    8888    jmp     short BootMenuPrint_RefreshInformation.FormatRelay
    8989
    90        
     90
    9191;--------------------------------------------------------------------
    9292; BootMenuPrint_FloppyMenuitemInformation
     
    101101ALIGN JUMP_ALIGN
    102102BootMenuPrint_RefreshInformation:
    103     CALL_MENU_LIBRARY ClearInformationArea     
    104        
     103    CALL_MENU_LIBRARY ClearInformationArea
     104
    105105    call    BootMenu_GetDriveToDXforMenuitemInCX_And_RamVars_GetSegmentToDS
    106106    jnc     BootMenuEvent_EventCompleted                ; if no menu selection, abort
     
    115115    inc     dl                                          ; are we a hard disk?
    116116    dec     dl                                          ; inc/dec will set SF, without modifying CF or DL
    117     js      .HardDiskRefreshInformation 
     117    js      .HardDiskRefreshInformation
    118118
    119119    jnc     .ours                                       ; Based on CF from FindDPT_ForDriveNumberInDL above
     
    122122.ours:
    123123    call    AH8h_GetDriveParameters
    124 .around:               
     124.around:
    125125
    126126    mov     ax, g_szFddSizeOr                           ; .PrintXTFloppyType
    127     test    bl, bl                                      ; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD)     
     127    test    bl, bl                                      ; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD)
    128128    jz      SHORT .PushAXAndOutput
    129129
     
    131131    cmp     bl, FLOPPY_TYPE_35_ED
    132132    ja      SHORT .PushAXAndOutput
    133        
     133
    134134    ; Fall to .PrintKnownFloppyType
    135135
     
    142142;   Corrupts registers:
    143143;       AX, BX, SI, DI
    144 ; 
     144;
    145145; Floppy Drive Types:
    146146;
    147 ;   0  Handled above 
     147;   0  Handled above
    148148;   1  FLOPPY_TYPE_525_DD          5 1/4   360K
    149149;   2  FLOPPY_TYPE_525_HD          5 1/4   1.2M
     
    153153;   6  FLOPPY_TYPE_35_ED           3 1/2   2.88M
    154154;   >6 Unknwon, handled above
    155 ; 
     155;
    156156;--------------------------------------------------------------------
    157157.PrintKnownFloppyType:
    158158    mov     al, (g_szFddSize - $$) & 0xff
    159159    push    ax
    160        
     160
    161161    mov     al, (g_szFddThreeHalf - $$) & 0xff
    162162    cmp     bl, FLOPPY_TYPE_525_HD
    163163    ja      .ThreeHalf
    164164    mov     al, (g_szFddFiveQuarter - $$) & 0xff
    165 .ThreeHalf:     
     165.ThreeHalf:
    166166    push    ax                                          ; "5 1/4" or "3 1/2"
    167167
     
    170170    mul     byte [cs:bx+FloppyTypes.rgbCapacity - 1]    ; -1 since 0 is handled above and not in the table
    171171
    172 .PushAXAndOutput:                   
     172.PushAXAndOutput:
    173173    push    ax
    174174
     
    189189;--------------------------------------------------------------------
    190190ALIGN JUMP_ALIGN
    191 .HardDiskRefreshInformation:       
     191.HardDiskRefreshInformation:
    192192    jc      .HardDiskMenuitemInfoForForeignDrive        ; Based on CF from FindDPT_ForDriveNumberInDL (way) above
    193193
     
    196196    call    BootMenuInfo_GetTotalSectorCount            ; Get Total LBA Size
    197197    jmp     .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
    198        
     198
    199199.HardDiskMenuitemInfoForForeignDrive:
    200200    call    DriveXlate_ToOrBack
     
    208208    push    ax                      ; Size in magnitude
    209209    push    cx                      ; Tenths
    210     push    dx                      ; Magnitude character       
    211                
     210    push    dx                      ; Magnitude character
     211
    212212    test    di,di
    213213    jz      short BootMenuPrint_FormatCSSIfromParamsInSSBP
     
    225225;   Returns:
    226226;       BP:     Popped from stack
    227 ;       CF:     Set since menu event was handled successfully       
     227;       CF:     Set since menu event was handled successfully
    228228;   Corrupts registers:
    229229;       AX, DI
     
    232232BootMenuPrint_FormatCSSIfromParamsInSSBP:
    233233    CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
    234     stc             ; Successfull return from menu event
     234    stc             ; Successful return from menu event
    235235    pop     bp
    236236    ret
    237        
    238        
     237
     238
    239239;--------------------------------------------------------------------
    240240; BootMenuPrint_ClearScreen
     
    364364    push    cx          ; Key attribute for last space
    365365    mov     si, g_szHotkey
    366        
    367 BootMenuPrint_FormatCSSIfromParamsInSSBP_Relay: 
     366
     367BootMenuPrint_FormatCSSIfromParamsInSSBP_Relay:
    368368    jmp     SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP
    369369
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrintCfg.asm

    r258 r294  
    2424;--------------------------------------------------------------------
    2525.BootMenuPrintCfg_ForOurDrive:
    26     eMOVZX  ax, BYTE [di+DPT.bIdevarsOffset]
     26    eMOVZX  ax, [di+DPT.bIdevarsOffset]
    2727    xchg    bx, ax                      ; CS:BX now points to IDEVARS
    2828    ; Fall to .PushAndFormatCfgString
     
    4040.PushAddressingMode:
    4141    AccessDPT_GetUnshiftedAddressModeToALZF
    42     ;; 
    43     ;; This multiply both shifts the addressing mode bits down to low order bits, and 
     42    ;;
     43    ;; This multiply both shifts the addressing mode bits down to low order bits, and
    4444    ;; at the same time multiplies by the size of the string displacement.  The result is in AH,
    4545    ;; with AL clear, and so we exchange AL and AH after the multiply for the final result.
    46     ;; 
     46    ;;
    4747    mov     cl,(1<<(8-ADDRESSING_MODE_FIELD_POSITION)) * g_szAddressingModes_Displacement
    4848    mul     cl
     
    5050    add     ax,g_szAddressingModes
    5151    push    ax
    52        
     52
    5353;--------------------------------------------------------------------
    5454; PushBlockMode
     
    8282    mov     al,g_szBusTypeValues_Displacement
    8383    mul     BYTE [cs:bx+IDEVARS.bDevice]
    84        
     84
    8585    shr     ax,1            ; divide by 2 since IDEVARS.bDevice is multiplied by 2
    86        
     86
    8787    add     ax,g_szBusTypeValues
    88     push    ax 
    89                
     88    push    ax
     89
    9090;--------------------------------------------------------------------
    9191; PushIRQ
     
    9999;--------------------------------------------------------------------
    100100.PushIRQ:
    101     mov     al, BYTE [cs:bx+IDEVARS.bIRQ]
     101    mov     al, [cs:bx+IDEVARS.bIRQ]
    102102    cbw
    103103    push    ax
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootSector.asm

    r148 r294  
    1111;       DS:     RAMVARS segment
    1212;   Returns:
    13 ;       ES:BX:  Ptr to boot sector (if successfull)
    14 ;       CF:     Set if boot sector loaded succesfully
     13;       ES:BX:  Ptr to boot sector (if successful)
     14;       CF:     Set if boot sector loaded successfully
    1515;               Cleared if failed to load boot sector
    1616;   Corrupts registers:
     
    4646;   Returns:
    4747;       AH:     INT 13h error code
    48 ;       ES:BX:  Ptr to boot sector (if successfull)
    49 ;       CF:     Cleared if read successfull
     48;       ES:BX:  Ptr to boot sector (if successful)
     49;       CF:     Cleared if read successful
    5050;               Set if any error
    5151;   Corrupts registers:
     
    7373;   Returns:
    7474;       AH:     INT 13h error code
    75 ;       CF:     Cleared if read successfull
     75;       CF:     Cleared if read successful
    7676;               Set if any error
    7777;   Corrupts registers:
     
    9696;       AH:     INT 13h error code
    9797;       ES:BX:  Ptr to boot sector
    98 ;       CF:     Cleared if read successfull
     98;       CF:     Cleared if read successful
    9999;               Set if any error
    100100;   Corrupts registers:
  • trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm

    r268 r294  
    66
    77
    8 %macro TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE 1
     8%macro TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE 1
    99    test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
    1010    jnz     SHORT %1
     
    4242    CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF DEVICE_SERIAL_PORT, .FinalizeDptForSerialPortDevice
    4343    jmp     IdeDPT_Finalize
    44 .FinalizeDptForSerialPortDevice: 
     44.FinalizeDptForSerialPortDevice:
    4545    jmp     SerialDPT_Finalize
    4646
     
    6363    %ifdef MODULE_SERIAL                ; IDE + JR-IDE/ISA + Serial
    6464    Device_ResetMasterAndSlaveController:
    65         TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort
     65        TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort
    6666        CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .ResetJrIDE
    6767        jmp     IdeCommand_ResetMasterAndSlaveController
     
    7575%elifdef MODULE_SERIAL                  ; IDE + Serial
    7676Device_ResetMasterAndSlaveController:
    77     TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort
     77    TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort
    7878    jmp     IdeCommand_ResetMasterAndSlaveController
    7979
     
    152152    %ifdef MODULE_SERIAL                ; IDE + JR-IDE/ISA + Serial
    153153    Device_OutputCommandWithParameters:
    154         TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE .OutputCommandToSerialPort
     154        TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE .OutputCommandToSerialPort
    155155        CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .OutputCommandToJrIDE
    156156        jmp     IdeCommand_OutputWithParameters
     
    164164%elifdef MODULE_SERIAL                  ; IDE + Serial
    165165Device_OutputCommandWithParameters:
    166     TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE .OutputCommandToSerialPort
     166    TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE .OutputCommandToSerialPort
    167167    jmp     IdeCommand_OutputWithParameters
    168168
     
    198198    %ifdef MODULE_SERIAL                ; IDE + JR-IDE/ISA + Serial
    199199    Device_SelectDrive:
    200         TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort
     200        TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort
    201201        CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .SelectJrIdeDrive
    202202        jmp     IdeCommand_SelectDrive
     
    210210%elifdef MODULE_SERIAL                  ; IDE + Serial
    211211Device_SelectDrive:
    212     TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort
     212    TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort
    213213    jmp     IdeCommand_SelectDrive
    214214
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm

    r285 r294  
    130130    ; Output Sector Address High (only used by LBA48)
    131131%ifdef MODULE_EBIOS
    132     eMOVZX  ax, BYTE [bp+IDEPACK.bLbaLowExt]    ; Zero sector count
     132    eMOVZX  ax, [bp+IDEPACK.bLbaLowExt]     ; Zero sector count
    133133    mov     cx, [bp+IDEPACK.wLbaMiddleAndHighExt]
    134134    call    IDEDEVICE%+OutputSectorCountAndAddress
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeError.asm

    r267 r294  
    2323
    2424%ifndef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS    ; JR-IDE/ISA
    25     jmp     ContinueFromMemIdeError
     25    jmp     ContinueFromMemIdeError     ; What's this supposed to do? *FIXME*
    2626%else
    2727ContinueFromMemIdeError:
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm

    r251 r294  
    5454;       AH:     BIOS Error code
    5555;       CX:     Number of successfully transferred sectors
    56 ;       CF:     0 if transfer succesfull
     56;       CF:     0 if transfer successful
    5757;               1 if any error
    5858;   Corrupts registers:
     
    121121;       AH:     BIOS Error code
    122122;       CX:     Number of successfully transferred sectors
    123 ;       CF:     0 if transfer succesfull
     123;       CF:     0 if transfer successful
    124124;               1 if any error
    125125;   Corrupts registers:
  • trunk/XTIDE_Universal_BIOS/Src/Device/MemoryMappedIDE/MemIdeTransfer.asm

    r267 r294  
    6464;       AH:     BIOS Error code
    6565;       CX:     Number of successfully transferred sectors
    66 ;       CF:     0 if transfer succesfull
     66;       CF:     0 if transfer successful
    6767;               1 if any error
    6868;   Corrupts registers:
     
    125125;       AH:     BIOS Error code
    126126;       CX:     Number of successfully transferred sectors
    127 ;       CF:     0 if transfer succesfull
     127;       CF:     0 if transfer successful
    128128;               1 if any error
    129129;   Corrupts registers:
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm

    r277 r294  
    2626
    2727    call    RamVars_GetSegmentToDS
    28        
     28
    2929    call    DriveXlate_ToOrBack
    3030    mov     [RAMVARS.xlateVars+XLATEVARS.bXlatedDrv], dl
    31        
     31
    3232    call    FindDPT_ForDriveNumberInDL              ; DS:DI points to our DPT, or NULL if not our drive
    3333    jnc     SHORT .OurFunction                      ; DPT found, this is one of our drives, and thus our function
    3434
    35     cmp     ah, 0
    36     jz      short .OurFunction                      ; we handle all function 0h requests (resets)
     35    test    ah, ah
     36    jz      SHORT .OurFunction                      ; we handle all function 0h requests (resets)
    3737    cmp     ah, 8
    38     jnz     SHORT Int13h_DirectCallToAnotherBios    ; non-8h function, handled by foreign bios
     38    jne     SHORT Int13h_DirectCallToAnotherBios    ; non-8h function, handled by foreign bios
    3939
    4040%ifndef MODULE_SERIAL_FLOPPY
    41 ; With floppy support, we handle all traffic for function 08h, as we need to wrap both hard disk and 
    42 ; floppy drive counts.  Without floppy support, we handle only hard disk traffic for function 08h, 
     41; With floppy support, we handle all traffic for function 08h, as we need to wrap both hard disk and
     42; floppy drive counts.  Without floppy support, we handle only hard disk traffic for function 08h,
    4343; and thus need the check below.
    4444;
    45     test    dl, dl                             
     45    test    dl, dl
    4646    jns     SHORT Int13h_DirectCallToAnotherBios
    47 %endif     
    48                
    49 .OurFunction:   
     47%endif
     48
     49.OurFunction:
    5050    ; Jump to correct BIOS function
    5151    eMOVZX  bx, ah
     
    141141    test    dl, dl
    142142    js      short Int13h_UnsupportedFunction
    143     mov     ah, 0
     143    xor     ah, ah
    144144    jmp     short Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    145145%endif
     
    172172%ifdef MODULE_SERIAL_FLOPPY
    173173    mov     al, [bp+IDEPACK.intpack+INTPACK.dl]
    174 Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH_ALHasDriveNumber:   
     174Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH_ALHasDriveNumber:
    175175    call    Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH_ALHasDriveNumber
    176176%else
     
    191191;   Returns:
    192192;       Depends on function
    193 ;       NOTE: ES:DI needs to be returned from the previous interrupt 
     193;       NOTE: ES:DI needs to be returned from the previous interrupt
    194194;             handler, for floppy DPT in function 08h
    195195;   Corrupts registers:
     
    251251.HardDisk:
    252252    LOAD_BDA_SEGMENT_TO ds, di
    253     mov     [bx], ah       
     253    mov     [bx], ah
    254254%else
    255255Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH:
    256256    ; Store error code to BDA
    257     LOAD_BDA_SEGMENT_TO ds, di     
     257    LOAD_BDA_SEGMENT_TO ds, di
    258258    mov     [BDA.bHDLastSt], ah
    259259%endif
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm

    r282 r294  
    1919;   Returns with INTPACK:
    2020;       AH:     Int 13h return status (from drive requested in DL)
    21 ;       CF:     0 if succesfull, 1 if error
     21;       CF:     0 if successful, 1 if error
    2222;--------------------------------------------------------------------
    2323ALIGN JUMP_ALIGN
     
    2828%ifdef MODULE_SERIAL_FLOPPY
    2929;
    30 ; "Reset" emulatd serial floppy drives, if any.  There is nothing to actually do for this reset,
     30; "Reset" emulated serial floppy drives, if any.  There is nothing to actually do for this reset,
    3131; but record the proper error return code if one of these floppy drives is the drive requested.
    3232;
     
    3939
    4040    adc     dl, al                                      ; second drive (CF set) if present
    41                                                         ; If no drive is present, this will result in ffh which 
     41                                                        ; If no drive is present, this will result in ffh which
    4242                                                        ; won't match a drive
    4343    call    BackupErrorCodeFromTheRequestedDriveToBH
     
    4848    test    bl, bl                                      ; If we were called with a floppy disk, then we are done,
    4949    jns     SHORT .SkipHardDiskReset                    ; don't do hard disks.
    50        
     50
    5151    call    ResetForeignHardDisks
    5252
    53     ; Resetting our hard disks will modify dl and bl to be idevars offset based instead of drive number based, 
     53    ; Resetting our hard disks will modify dl and bl to be idevars offset based instead of drive number based,
    5454    ; such that this call must be the last in the list of reset routines called.
    5555    ;
     
    5757    ; and we need to override that value if we are xlate'd into 80h with one of our drives.
    5858    ;
    59     call    ResetHardDisksHandledByOurBIOS         
     59    call    ResetHardDisksHandledByOurBIOS
    6060
    6161.SkipHardDiskReset:
     
    139139;   Parameters:
    140140;       DS:DI:  Ptr to DPT for requested drive
    141 ;               If DPT pointer is not available, or error result in BH won't be used anyway, 
     141;               If DPT pointer is not available, or error result in BH won't be used anyway,
    142142;               enter through .ErrorCodeNotUsed.
    143143;       SS:BP:  Ptr to IDEPACK
     
    148148;--------------------------------------------------------------------
    149149ResetHardDisksHandledByOurBIOS:
    150     mov     bl, 0                                       ; Assume Null IdevarsOffset for now, assuming foreign drive
     150    xor     bl, bl                                      ; Assume Null IdevarsOffset for now, assuming foreign drive
    151151    test    di, di
    152152    jz      .ErrorCodeNotUsed
    153153    mov     bl, [di+DPT.bIdevarsOffset]                 ; replace drive number with Idevars pointer for cmp with dl
    154        
    155 .ErrorCodeNotUsed:                                      ; BH will be garbage on exit if thie entry point is used,
     154
     155.ErrorCodeNotUsed:                                      ; BH will be garbage on exit if this entry point is used,
    156156                                                        ; but reset of all drives will still happen
    157157
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH10h_HReady.asm

    r150 r294  
    1515;   Returns with INTPACK:
    1616;       AH:     Int 13h return status
    17 ;       CF:     0 if succesfull, 1 if error
     17;       CF:     0 if successful, 1 if error
    1818;--------------------------------------------------------------------
    1919ALIGN JUMP_ALIGN
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH11h_HRecal.asm

    r162 r294  
    1515;   Returns with INTPACK:
    1616;       AH:     BIOS Error code
    17 ;       CF:     0 if succesfull, 1 if error
     17;       CF:     0 if successful, 1 if error
    1818;--------------------------------------------------------------------
    1919ALIGN JUMP_ALIGN
     
    3535;   Returns:
    3636;       AH:     BIOS Error code
    37 ;       CF:     0 if succesfull, 1 if error
     37;       CF:     0 if successful, 1 if error
    3838;   Corrupts registers:
    3939;       AL, BX, CX, DX
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH15h_HSize.asm

    r285 r294  
    1414;       SS:BP:  Ptr to IDEPACK
    1515;   Returns with INTPACK:
    16 ;       If succesfull:
     16;       If successful:
    1717;           AH:     Hard Disk: 3 (Hard disk accessible)
    1818;                   Floppy:    1 (Floppy disk, without change detection)
     
    2828%ifdef MODULE_SERIAL_FLOPPY
    2929    mov     cl, 1                                       ; 1 = floppy disk, no change detection
    30                
    31     test    dl,dl                                       ; DO NOT store the sector count if this is a 
    32     jns     .FloppyDrive                                ; floppy disk, some OS's depend on this not 
     30
     31    test    dl,dl                                       ; DO NOT store the sector count if this is a
     32    jns     .FloppyDrive                                ; floppy disk, some OS's depend on this not
    3333                                                        ; happening for floppies in order to boot.
    3434%endif
    35        
     35
    3636    call    AH15h_GetSectorCountToBXDXAX
    3737    mov     [bp+IDEPACK.intpack+INTPACK.cx], dx         ; HIWORD to CX
    3838    xchg    [bp+IDEPACK.intpack+INTPACK.dx], ax         ; LOWORD to DX, AL gets drive number
    3939
    40     xor     ah, ah     
    41 %ifdef MODULE_SERIAL_FLOPPY             
     40    xor     ah, ah
     41%ifdef MODULE_SERIAL_FLOPPY
    4242    mov     cl, 3                                       ; 3 = Hard Disk Accessible
    4343.FloppyDrive:
    44        
    45     call    Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH_ALHasDriveNumber   ; Store success to BDA and CF       
    46     mov     BYTE [bp+IDEPACK.intpack+INTPACK.ah], cl
     44
     45    call    Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH_ALHasDriveNumber   ; Store success to BDA and CF
     46    mov     [bp+IDEPACK.intpack+INTPACK.ah], cl
    4747%else
    48     call    Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH    ; Store success to BDA and CF       
     48    call    Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH    ; Store success to BDA and CF
    4949    mov     BYTE [bp+IDEPACK.intpack+INTPACK.ah], 3
    50 %endif     
    51        
     50%endif
     51
    5252    jmp     Int13h_ReturnFromHandlerWithoutStoringErrorCode
    5353
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1h_HStatus.asm

    r258 r294  
    2323%ifdef MODULE_SERIAL_FLOPPY
    2424    test    dl, dl
    25     jns     .HardDisk
    26     mov     ah, [BDA.bFDRetST]      ; Unlike for hard disks below, floppy version does not clear the status
     25    js      .HardDisk
     26    mov     ah, [BDA.bFDRetST]  ; Unlike for hard disks below, floppy version does not clear the status
    2727    jmp     .done
    28 .HardDisk: 
     28.HardDisk:
    2929%endif
    30        
    31     xchg    ah, [BDA.bHDLastSt]     ; Load and clear last error
    32                                     ; Note that AH is cleared with the LOAD_BDA_SEGMENT above
    33                
     30
     31    xchg    ah, [BDA.bHDLastSt] ; Load and clear last error (AH is cleared with the LOAD_BDA_SEGMENT_TO above)
     32
    3433.done:
     34%ifndef USE_186
    3535    call    Int13h_SetErrorCodeToIntpackInSSBPfromAH
    3636    jmp     Int13h_ReturnFromHandlerWithoutStoringErrorCode
     37%else
     38    push    Int13h_ReturnFromHandlerWithoutStoringErrorCode
     39    jmp     Int13h_SetErrorCodeToIntpackInSSBPfromAH
     40%endif
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH23h_HFeatures.asm

    r170 r294  
    2424;   Returns with INTPACK:
    2525;       AH:     Int 13h return status
    26 ;       CF:     0 if succesfull, 1 if error
     26;       CF:     0 if successful, 1 if error
    2727;--------------------------------------------------------------------
    2828ALIGN JUMP_ALIGN
     
    5151;   Returns:
    5252;       AH:     Int 13h return status
    53 ;       CF:     0 if succesfull, 1 if error
     53;       CF:     0 if successful, 1 if error
    5454;   Corrupts registers:
    5555;       AL, BX, CX, DX
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.asm

    r232 r294  
    1818;   Returns with INTPACK:
    1919;       AH:     Int 13h return status
    20 ;       CF:     0 if succesfull, 1 if error
     20;       CF:     0 if successful, 1 if error
    2121;--------------------------------------------------------------------
    2222AH24h_HandlerForSetMultipleBlocks:
     
    3838;   Returns:
    3939;       AH:     Int 13h return status
    40 ;       CF:     0 if succesfull, 1 if error
     40;       CF:     0 if successful, 1 if error
    4141;   Corrupts registers:
    4242;       AL, BX, CX, DX
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH25h_HDrvID.asm

    r221 r294  
    1818;   Returns with INTPACK:
    1919;       AH:     Int 13h return status
    20 ;       CF:     0 if succesfull, 1 if error
     20;       CF:     0 if successful, 1 if error
    2121;--------------------------------------------------------------------
    2222ALIGN JUMP_ALIGN
     
    4040;   Returns with INTPACK:
    4141;       AH:     Int 13h return status
    42 ;       CF:     0 if succesfull, 1 if error
     42;       CF:     0 if successful, 1 if error
    4343;   Corrupts registers:
    4444;       AL, BX, CX, DX
     
    5353    call    AccessDPT_GetDriveSelectByteToAL
    5454    mov     bh, al
    55     eMOVZX  ax, BYTE [di+DPT.bIdevarsOffset]
     55    eMOVZX  ax, [di+DPT.bIdevarsOffset]
    5656    xchg    bp, ax
    5757    call    Device_IdentifyToBufferInESSIwithDriveSelectByteInBH
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH2h_HRead.asm

    r258 r294  
    2020;               Bits 5...0: Starting sector number (1...63)
    2121;       DH:     Starting head number (0...255)
    22 ;       ES:BX:  Pointer to buffer recieving data
     22;       ES:BX:  Pointer to buffer receiving data
    2323;   Returns with INTPACK:
    2424;       AH:     Int 13h/40h floppy return status
    2525;       AL:     Burst error length if AH returns 11h (we never return error code 11h)
    2626;               Number of sectors actually read (only valid if CF set for someBIOSes)
    27 ;       CF:     0 if successfull, 1 if error
     27;       CF:     0 if successful, 1 if error
    2828;--------------------------------------------------------------------
    2929ALIGN JUMP_ALIGN
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH3h_HWrite.asm

    r249 r294  
    2424;       AH:     Int 13h/40h floppy return status
    2525;       AL:     Number of sectors actually written (only valid if CF set for someBIOSes)
    26 ;       CF:     0 if successfull, 1 if error
     26;       CF:     0 if successful, 1 if error
    2727;--------------------------------------------------------------------
    2828ALIGN JUMP_ALIGN
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH4h_HVerify.asm

    r249 r294  
    2323;       AH:     Int 13h/40h floppy return status
    2424;       AL:     Number of sectors actually verified (only valid if CF set for someBIOSes)
    25 ;       CF:     0 if successfull, 1 if error
     25;       CF:     0 if successful, 1 if error
    2626;--------------------------------------------------------------------
    2727ALIGN JUMP_ALIGN
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH8h_HParams.asm

    r285 r294  
    2222;       ES:DI:  Floppy DPT (for floppies only)
    2323;       AH:     Int 13h/40h floppy return status
    24 ;       CF:     0 if successfull, 1 if error
     24;       CF:     0 if successful, 1 if error
    2525;--------------------------------------------------------------------
    2626AH8h_HandlerForReadDiskDriveParameters:
     
    3131    jnc     SHORT .MidGame
    3232    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    33        
    34 .OurDrive:     
     33
     34.OurDrive:
    3535    call    AH8h_GetDriveParameters
    3636
     
    4141%endif
    4242    ;; fall-through
    43        
    44 .MidGame:       
     43
     44.MidGame:
    4545    call    RamVars_GetCountOfKnownDrivesToAX       ; assume hard disk for now, will discard if for floppies
    4646
    4747    test    byte [bp+IDEPACK.intpack+INTPACK.dl], 080h
    4848    jnz     .Done
    49        
     49
    5050    mov     [bp+IDEPACK.intpack+INTPACK.bl], bl
    5151
    5252    mov     [bp+IDEPACK.intpack+INTPACK.es], es
    53     mov     [bp+IDEPACK.intpack+INTPACK.di], di     
     53    mov     [bp+IDEPACK.intpack+INTPACK.di], di
    5454
    5555    call    FloppyDrive_GetCountToAX
    5656
    57 .Done: 
     57.Done:
    5858    mov     ah, dh
    59        
     59
    6060    mov     [bp+IDEPACK.intpack+INTPACK.cx], cx
    6161    xchg    [bp+IDEPACK.intpack+INTPACK.dx], ax     ; recover DL for BDA last status byte determination
     
    6363    xor     ah, ah
    6464%ifdef MODULE_SERIAL_FLOPPY
    65     jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH_ALHasDriveNumber           
     65    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH_ALHasDriveNumber
    6666%else
    6767    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
     
    118118    eSHR_IM bl,FLGH_DPT_SERIAL_FLOPPY_TYPE_FIELD_POSITION
    119119%endif
    120 %endif     
     120%endif
    121121    ret
    122122
     
    127127; So we return fixed values out of the ROM for callers who might be expecting this information.
    128128;
    129 ; On AT systems, we return the information for a 1.44 MB disk, 
     129; On AT systems, we return the information for a 1.44 MB disk,
    130130; and on XT systems, we return the information for a 360 KB disk.
    131131;
     
    138138
    139139    db      1h << 1 | 0             ; Offset 1: Typical values of 1 for head load time
    140                                     ;           DMA used (although it actually is not, but is more restrctive)
    141     db      25h                     ; Offset 2: Inactiviy motor turn-off delay,
     140                                    ;           DMA used (although it actually is not, but is more restrictive)
     141    db      25h                     ; Offset 2: Inactivity motor turn-off delay,
    142142                                    ;           Typical value of 25h for 2 second delay
    143143    db      02h                     ; Offset 3: Sector size, always 512
     
    161161    db      0f6h                    ; Offset 8: Fill byte for format
    162162    db      0fh                     ; Offset 9: Head setting time
    163     db      08h                     ; Offset A: Wait for motor startpu time
     163    db      08h                     ; Offset A: Wait for motor startup time
    164164
    165165%ifdef USE_AT
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm

    r279 r294  
    1515;   Returns with INTPACK:
    1616;       AH:     Int 13h return status
    17 ;       CF:     0 if succesfull, 1 if error
     17;       CF:     0 if successful, 1 if error
    1818;--------------------------------------------------------------------
    1919AH9h_HandlerForInitializeDriveParameters:
     
    3636;   Returns:
    3737;       AH:     Int 13h return status
    38 ;       CF:     0 if succesfull, 1 if error
     38;       CF:     0 if successful, 1 if error
    3939;   Corrupts registers:
    4040;       AL, BX, DX
     
    4545
    4646%ifdef MODULE_SERIAL
    47     ; 
    48     ; no need to do this for serial deveices, and we use the DPT_RESET flag bits
     47    ;
     48    ; no need to do this for serial devices, and we use the DPT_RESET flag bits
    4949    ; to store the drive type for serial floppy drives (MODULE_SERIAL_FLOPPY)
    5050    ;
    5151    xor     ah, ah
    5252    test    byte [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE    ; Clears CF
    53     jnz     .ReturnNotSuccessfull
     53    jnz     .ReturnNotSuccessful
    5454%endif
    55        
     55
    5656    ; Try to select drive and wait until ready
    5757    or      BYTE [di+DPT.bFlagsHigh], MASKH_DPT_RESET       ; Everything uninitialized
     
    5959    mov     [bp+IDEPACK.bDrvAndHead], al
    6060    call    Device_SelectDrive
    61     jc      SHORT .ReturnNotSuccessfull
     61    jc      SHORT .ReturnNotSuccessful
    6262    and     BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_RESET_nDRDY ; Clear since success
    6363
     
    8080.InitializeBlockMode:
    8181    call    InitializeBlockMode
    82     jc      SHORT .ReturnNotSuccessfull
     82    jc      SHORT .ReturnNotSuccessful
    8383    and     BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_RESET_nSETBLOCK ; Keeps CF clear
    8484
    85 .ReturnNotSuccessfull:
     85.ReturnNotSuccessful:
    8686    pop     cx
    8787    pop     si
     
    9696;   Returns:
    9797;       AH:     BIOS Error code
    98 ;       CF:     Cleared if succesfull
     98;       CF:     Cleared if successful
    9999;               Set if any error
    100100;   Corrupts registers:
     
    121121;   Returns:
    122122;       AH:     BIOS Error code
    123 ;       CF:     Cleared if succesfull
     123;       CF:     Cleared if successful
    124124;               Set if any error
    125125;   Corrupts registers:
     
    146146;   Returns:
    147147;       AH:     BIOS Error code
    148 ;       CF:     Cleared if succesfull
     148;       CF:     Cleared if successful
    149149;               Set if any error
    150150;   Corrupts registers:
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHCh_HSeek.asm

    r162 r294  
    2121;   Returns with INTPACK:
    2222;       AH:     BIOS Error code
    23 ;       CF:     0 if succesfull, 1 if error
     23;       CF:     0 if successful, 1 if error
    2424;--------------------------------------------------------------------
    2525ALIGN JUMP_ALIGN
     
    4444;   Returns:
    4545;       AH:     BIOS Error code
    46 ;       CF:     0 if succesfull, 1 if error
     46;       CF:     0 if successful, 1 if error
    4747;   Corrupts registers:
    4848;       AL, BX, CX, DX
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm

    r282 r294  
    1515;   Returns with INTPACK:
    1616;       AH:     Int 13h return status
    17 ;       CF:     0 if succesfull, 1 if error
     17;       CF:     0 if successful, 1 if error
    1818;--------------------------------------------------------------------
    1919ALIGN JUMP_ALIGN
     
    3737;   Returns:
    3838;       AH:     Int 13h return status
    39 ;       CF:     0 if succesfull, 1 if error
     39;       CF:     0 if successful, 1 if error
    4040;   Corrupts registers:
    4141;       AL, SI
     
    5353
    5454    ; Initialize Master and Slave drives
    55     mov     al, [di+DPT.bIdevarsOffset]         ; pointer to controller we are looking to reset
    56     mov     ah, 0                               ; initialize error code, assume success
    57        
     55    eMOVZX  ax, [di+DPT.bIdevarsOffset]         ; (AL) pointer to controller we are looking to reset
     56                                                ; (AH) initialize error code, assume success
     57
    5858    mov     si, IterateAndResetDrives
    5959    call    FindDPT_IterateAllDPTs
     
    7070; IterateAndResetDrives: Iteration routine for use with IterateAllDPTs.
    7171;
    72 ; When a drive on the controller is found, it is reset, and the error code 
     72; When a drive on the controller is found, it is reset, and the error code
    7373; merged into overall error code for this controller.  Master will be reset
    7474; first.  Note that the iteration will go until the end of the DPT list.
     
    7979    push    ax
    8080    call    AH9h_InitializeDriveForUse          ; Reset Master and Slave (Master will come first in DPT list)
    81     pop     ax     
     81    pop     ax
    8282    jnc     .done
    8383    or      ah, (RET_HD_RESETFAIL << 1) | 1     ; OR in Reset Failed error code and CF, will SHR into position later
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH41h_CheckIfExtensionsPresent.asm

    r167 r294  
    1919;       BX:     AA55h
    2020;       CX:     Support bits
    21 ;       CF:     0 if succesfull, 1 if error
     21;       CF:     0 if successful, 1 if error
    2222;--------------------------------------------------------------------
    2323ALIGN JUMP_ALIGN
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH42h_ExtendedReadSectors.asm

    r249 r294  
    1818;   Returns with INTPACK:
    1919;       AH:     Int 13h return status
    20 ;       CF:     0 if succesfull, 1 if error
     20;       CF:     0 if successful, 1 if error
    2121;   Return with Disk Address Packet in INTPACK:
    2222;       .wSectorCount   Number of sectors read successfully
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH43h_ExtendedWriteSectors.asm

    r249 r294  
    2020;   Returns with INTPACK:
    2121;       AH:     Int 13h return status
    22 ;       CF:     0 if succesfull, 1 if error
     22;       CF:     0 if successful, 1 if error
    2323;   Return with Disk Address Packet in INTPACK:
    2424;       .wSectorCount   Number of sectors written successfully
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH44h_ExtendedVerifySectors.asm

    r249 r294  
    1818;   Returns with INTPACK:
    1919;       AH:     Int 13h return status
    20 ;       CF:     0 if succesfull, 1 if error
     20;       CF:     0 if successful, 1 if error
    2121;   Return with Disk Address Packet in INTPACK:
    2222;       .wSectorCount   Number of sectors verified successfully
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH47h_ExtendedSeek.asm

    r249 r294  
    1818;   Returns with INTPACK:
    1919;       AH:     Int 13h return status
    20 ;       CF:     0 if succesfull, 1 if error
     20;       CF:     0 if successful, 1 if error
    2121;--------------------------------------------------------------------
    2222ALIGN JUMP_ALIGN
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH48h_GetExtendedDriveParameters.asm

    r230 r294  
    1919;       AH:     Int 13h return status
    2020;       DS:SI:  Ptr to Extended Drive Information Table
    21 ;       CF:     0 if succesfull, 1 if error
     21;       CF:     0 if successful, 1 if error
    2222;--------------------------------------------------------------------
    2323AH48h_HandlerForGetExtendedDriveParameters:
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Address.asm

    r230 r294  
    128128ConvertLCHStoLBARegisterValues:
    129129    ; cylToSeek*headsPerCyl (18-bit result)
    130     mov     ax, cx                  ; Copy Cylinder number to AX
    131     ; We could save a byte here by using CWD instead of the XOR DH, DH in eMOVZX
    132     ; but I'm not sure how that would affect speed.
     130    mov     ax, LBA_ASSIST_SPT      ; Load Sectors per Track
     131    xchg    cx, ax                  ; Cylinder number to AX, Sectors per Track to CX
    133132
    134     eMOVZX  dx, BYTE [di+DPT.bLbaHeads]
     133%ifdef USE_386
     134    movzx   dx, [di+DPT.bLbaHeads]
     135%else
     136    cwd
     137    mov     dl, [di+DPT.bLbaHeads]
     138%endif
    135139    mul     dx                      ; DX:AX = cylToSeek*headsPerCyl
    136140
     
    141145
    142146    ; *=sectPerTrack (18-bit by 6-bit multiplication with 24-bit result)
    143     mov     cx, LBA_ASSIST_SPT      ; Load Sectors per Track
    144147    xchg    ax, dx                  ; Hiword to AX, loword to DX
    145148    mul     cl                      ; AX = hiword * Sectors per Track
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Prepare.asm

    r221 r294  
    3434    cmp     ax, BYTE 127
    3535    ja      SHORT InvalidNumberOfSectorsRequested
    36     ; Fall to GetEbiosCommandIndexToBX
    3736
    38 ;--------------------------------------------------------------------
    39 ; GetEbiosCommandIndexToBX
    40 ;   Parameters:
    41 ;       DS:DI:  Ptr to DPT
    42 ;       ES:SI:  Ptr to DAP (Disk Address Packet)
    43 ;   Returns:
    44 ;       BX:     Index to command lookup table
    45 ;   Corrupts registers:
    46 ;       AX, DX
    47 ;--------------------------------------------------------------------
    48 GetEbiosCommandIndexToBX:
     37    ; Get EBIOS command index to BX
    4938    ; LBA28 or LBA48 command
    50     xor     dx, dx
     39    cwd
    5140    mov     al, [es:si+DAP.qwLBA+3] ; Load LBA48 byte 3 (bits 24...31)
    52     and     ax, 00F0h               ; Clear LBA28 bits 24...27
     41    and     al, 0F0h                ; Clear LBA28 bits 24...27
    5342    or      ax, [es:si+DAP.qwLBA+4] ; Set bits from LBA bytes 4 and 5
    5443    cmp     dx, ax                  ; Set CF if any of bits 28...47 set
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm

    r269 r294  
    2626    mov     cx, g_szDetectMaster
    2727    mov     bh, MASK_DRVNHEAD_SET                               ; Select Master drive
    28     call    StartDetectionWithDriveSelectByteInBHandStringInAX  ; Detect and create DPT + BOOTNFO
     28    call    StartDetectionWithDriveSelectByteInBHandStringInCX  ; Detect and create DPT + BOOTNFO
    2929
    3030    mov     cx, g_szDetectSlave
    3131    mov     bh, MASK_DRVNHEAD_SET | FLG_DRVNHEAD_DRV
    32     call    StartDetectionWithDriveSelectByteInBHandStringInAX
     32    call    StartDetectionWithDriveSelectByteInBHandStringInCX
    3333
    3434    pop     cx
     
    7272    mov     al, [es:BDA.bHDCount]
    7373    add     cl, al                      ; Add our drives to the system count
    74     mov     [es:BDA.bHDCount], cl       
    75     or      al, 80h                     ; Or in hard disk flag     
    76     mov     [RAMVARS.bFirstDrv], al     ; Store first drive number     
    77 
    78 .AddFloppies:       
    79 %ifdef MODULE_SERIAL_FLOPPY     
     74    mov     [es:BDA.bHDCount], cl
     75    or      al, 80h                     ; Or in hard disk flag
     76    mov     [RAMVARS.bFirstDrv], al     ; Store first drive number
     77
     78.AddFloppies:
     79%ifdef MODULE_SERIAL_FLOPPY
    8080;----------------------------------------------------------------------
    8181;
     
    8484    dec     ch
    8585    mov     al, ch
    86     js      .NoFloppies                     ; if no drives are present, we store 0ffh       
     86    js      .NoFloppies                     ; if no drives are present, we store 0ffh
    8787
    8888    call    FloppyDrive_GetCountFromBIOS_or_BDA
     
    9292    add     al, ch                          ; Add our drives to existing drive count
    9393    cmp     al, 3                           ; For BDA, max out at 4 drives (ours is zero based)
    94     jl      .MaxBDAFloppiesExceeded
    95     mov     al, 3                           
     94    jb      .MaxBDAFloppiesExceeded
     95    mov     al, 3
    9696.MaxBDAFloppiesExceeded:
    9797    eROR_IM al, 2                           ; move to bits 6-7
    9898    inc     ax                              ; low order bit, indicating floppy drive exists
    9999
    100     mov     ah, [es:BDA.wEquipment]         ; Load Equipment WORD low byte 
     100    mov     ah, [es:BDA.wEquipment]         ; Load Equipment WORD low byte
    101101    and     ah, 03eh                        ; Mask off drive number and drives present bit
    102102    or      al, ah                          ; Or in new values
     
    111111    shr     ch, 1                           ; number of drives, 1 or 2 only, to CF flag (clear=1, set=2)
    112112    rcl     al, 1                           ; starting drive number in upper 7 bits, number of drives in low bit
    113 .NoFloppies:   
     113.NoFloppies:
    114114    mov     [RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst], al
    115115%endif
    116        
     116
    117117    ret
    118118
    119 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS       
     119%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
    120120    %if FLG_ROMVARS_SERIAL_SCANDETECT != 8
    121121        %error "DetectDrives is currently coded to assume that FLG_ROMVARS_SERIAL_SCANDETECT is the same bit as the ALT key code in the BDA.  Changes in the code will be needed if these values are no longer the same."
     
    125125
    126126;--------------------------------------------------------------------
    127 ; StartDetectionWithDriveSelectByteInBHandStringInAX
     127; StartDetectionWithDriveSelectByteInBHandStringInCX
    128128;   Parameters:
    129129;       BH:     Drive Select byte for Drive and Head Register
     
    137137;       AX, BX, CX, DX, SI, DI
    138138;--------------------------------------------------------------------
    139 StartDetectionWithDriveSelectByteInBHandStringInAX:
    140     call    DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP
     139StartDetectionWithDriveSelectByteInBHandStringInCX:
     140    call    DetectPrint_StartDetectWithMasterOrSlaveStringInCXandIdeVarsInCSBP
    141141    ; Fall to .ReadAtaInfoFromHardDisk
    142142
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm

    r285 r294  
    2828
    2929;--------------------------------------------------------------------
    30 ; DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP
     30; DetectPrint_StartDetectWithMasterOrSlaveStringInCXandIdeVarsInCSBP
    3131;   Parameters:
    3232;       CS:CX:  Ptr to "Master" or "Slave" string
     
    3838;       AX, SI, DI, CX
    3939;--------------------------------------------------------------------
    40 DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP:
     40DetectPrint_StartDetectWithMasterOrSlaveStringInCXandIdeVarsInCSBP:
    4141    mov     ax, [cs:bp+IDEVARS.wPort]       ; for IDE: AX=port address, DH=.bDevice
    4242    mov     dx, [cs:bp+IDEVARS.bDevice-1]   ; for Serial: AL=port address>>2, AH=baud rate
     
    4848
    4949    mov     si, g_szDetectOuter             ; Load SI with default wrapper string "IDE %s at %s: "
    50        
     50
    5151    push    bp                              ; setup stack for call to
    5252    mov     bp, sp                          ; BootMenuPrint_FormatCSSIfromParamsInSSBP
     
    9898    mov     cl, (g_szDetectCOMSmall-$$) & 0xff  ; Setup secondary print string for "COMn/XXy00"
    9999
    100 .pushAndPrintSerial:   
     100.pushAndPrintSerial:
    101101    mov     si, g_szDetectOuterSerial       ; Finally load SI with wrapper string "Serial %s on %s: "
    102102
    103103.pushAndPrint:
    104104%endif
    105        
     105
    106106    push    cx                              ; Push print string
    107107    push    ax                              ; Push high order digits, or port address, or N/A
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DriveXlate.asm

    r248 r294  
    3939SwapFloppyDriveOrHardDisk:
    4040    mov     ah, 80h                 ; Assume hard disk
    41     mov     al, BYTE [RAMVARS.xlateVars+XLATEVARS.bHDSwap]
     41    mov     al, [RAMVARS.xlateVars+XLATEVARS.bHDSwap]
    4242    test    dl, ah                  ; Hard disk?
    4343    jnz     SHORT SwapDrive         ; If so, jump to swap
    44     mov     al, BYTE [RAMVARS.xlateVars+XLATEVARS.bFDSwap]
     44    mov     al, [RAMVARS.xlateVars+XLATEVARS.bFDSwap]
    4545    cbw
    4646    ; Fall to SwapDrive
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm

    r274 r294  
    127127;--------------------------------------------------------------------
    128128ALIGN JUMP_ALIGN
    129 FloppyDrive_GetCountToAX:       
     129FloppyDrive_GetCountToAX:
    130130%ifdef MODULE_SERIAL_FLOPPY
    131131    call    RamVars_UnpackFlopCntAndFirstToAL
    132132    js      .UseBIOSorBDA               ; We didn't add in any drives, counts here are not valid
    133        
    134     adc     al,1                        ; adds in the drive count bit, and adds 1 for count vs. 0-index, 
     133
     134    adc     al,1                        ; adds in the drive count bit, and adds 1 for count vs. 0-index,
    135135    jmp     .FinishCalc                 ; need to clear AH on the way out, and add in minimum drive numbers
    136136
    137 .UseBIOSorBDA: 
     137.UseBIOSorBDA:
    138138%endif
    139139    call    FloppyDrive_GetCountFromBIOS_or_BDA
    140140
    141 .FinishCalc:   
     141.FinishCalc:
    142142    mov     ah, [cs:ROMVARS.bMinFddCnt]
    143143    MAX_U   al, ah
    144144    cbw
    145        
    146     ret
    147 
    148 ALIGN JUMP_ALIGN       
     145
     146    ret
     147
     148ALIGN JUMP_ALIGN
    149149FloppyDrive_GetCountFromBIOS_or_BDA:
    150150    push    es
     
    152152;--------------------------------------------------------------------
    153153; Reads Floppy Drive Count from BIOS.
    154 ; Does not work on most XT systems. Call FloppyDrive_GetCountFromBDA
     154; Does not work on most XT systems. Call .GetCountFromBDA
    155155; if this function fails.
    156156;
    157 ; GetCountFromBIOS
     157; .GetCountFromBIOS
    158158;   Parameters:
    159159;       Nothing
    160160;   Returns:
    161161;       AL:     Number of Floppy Drives
    162 ;       CF:     Cleared if successfull
     162;       CF:     Cleared if successful
    163163;               Set if BIOS function not supported
    164164;   Corrupts registers:
     
    169169.GetCountFromBIOS:
    170170    push    di
    171     push    es
    172171    push    bx
    173172    push    cx
     
    182181    pop     cx
    183182    pop     bx
    184     pop     es
    185183    pop     di
    186184%endif
     
    188186;--------------------------------------------------------------------
    189187; Reads Floppy Drive Count (0...4) from BIOS Data Area.
    190 ; This function should be used only if FloppyDrive_GetCountFromBIOS fails.
    191 ;
    192 ; GetCountFromBDA
    193 ;   Parameters:
    194 ;       Nothing
    195 ;   Returns:
    196 ;       CL:     Number of Floppy Drives
    197 ;   Corrupts registers:
    198 ;       CH, ES
     188; This function should be used only if .GetCountFromBIOS fails.
     189;
     190; .GetCountFromBDA
     191;   Parameters:
     192;       Nothing
     193;   Returns:
     194;       AL:     Number of Floppy Drives
     195;   Corrupts registers:
     196;       AH, ES
    199197;--------------------------------------------------------------------
    200198%ifndef USE_AT
     
    203201    LOAD_BDA_SEGMENT_TO es, ax
    204202    mov     al, [es:BDA.wEquipment]         ; Load Equipment WORD low byte
    205     mov     ah, al                          ; Copy it to CH
     203    mov     ah, al                          ; Copy it to AH
    206204    and     ax, 0C001h                      ; Leave bits 15..14 and 0
    207205    eROL_IM ah, 2                           ; EW low byte bits 7..6 to 1..0
    208     add     al, ah                          ; CL = Floppy Drive count
     206    add     al, ah                          ; AL = Floppy Drive count
    209207%endif
    210208
    211209    pop     es
    212210    ret
    213        
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm

    r258 r294  
    6262    mov     di, ROMVARS.ideVars0            ; CS:SI points to first IDEVARS
    6363.IdeControllerLoop:
    64     mov     al, BYTE [cs:di+IDEVARS.bIRQ]
     64    mov     al, [cs:di+IDEVARS.bIRQ]
    6565    add     di, BYTE IDEVARS_size           ; Increment to next controller
    6666    call    .InstallLowOrHighIrqHandler
     
    147147;--------------------------------------------------------------------
    148148Interrupts_UnmaskInterruptControllerForDriveInDSDI:
    149     eMOVZX  bx, BYTE [di+DPT.bIdevarsOffset]
     149    eMOVZX  bx, [di+DPT.bIdevarsOffset]
    150150    mov     al, [cs:bx+IDEVARS.bIRQ]
    151151    test    al, al
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r292 r294  
    1313;                   file (so no linker needed, Nasm does it all).
    1414
    15 ORG 000h                        ; Code start offset 0000h
     15    ORG 0                           ; Code start offset 0000h
    1616
    1717%define MENUEVENT_INLINE_OFFSETS    ; Only one menu required, save space and inline offsets
     
    201201    %include "IdeTransfer.asm"      ; Must be included after IdeCommand.asm
    202202    %include "IdeWait.asm"
    203     %include "IdeError.asm"         ; Must be included after IdeWait.asm       
     203    %include "IdeError.asm"         ; Must be included after IdeWait.asm
    204204    %include "IdeDPT.asm"
    205205    %include "IdeIO.asm"
     
    215215    %include "MemIdeTransfer.asm"   ; Must be included after IdeCommand.asm
    216216    %include "IdeWait.asm"
    217     %include "IdeError.asm"         ; Must be included after IdeWait.asm       
     217    %include "IdeError.asm"         ; Must be included after IdeWait.asm
    218218%undef IDEDEVICE
    219219%endif
  • trunk/XTIDE_Universal_BIOS/Src/Strings.asm

    r292 r294  
    2929%endif
    3030
    31 ; The following strings are used by DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP
     31; The following strings are used by DetectPrint_StartDetectWithMasterOrSlaveStringInCXandIdeVarsInCSBP
    3232; To support an optimization in that code, these strings must start on the same 256 byte page,
    3333; which is checked at assembly time below.
     
    4949%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
    5050    %if ((g_szDetectEnd-$$) & 0xff00) <> ((g_szDetectStart-$$) & 0xff00)
    51         %error "g_szDetect* strings must start on the same 256 byte page, required by DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP.  Please move this block up or down within strings.asm"
     51        %error "g_szDetect* strings must start on the same 256 byte page, required by DetectPrint_StartDetectWithMasterOrSlaveStringInCXandIdeVarsInCSBP.  Please move this block up or down within strings.asm"
    5252    %endif
    5353%endif
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm

    r262 r294  
    1818;   Returns:
    1919;       DL:     Drive number for new drive
    20 ;       DS:DI:  Ptr to Disk Parameter Table (if succesfull)
     20;       DS:DI:  Ptr to Disk Parameter Table (if successful)
    2121;       CF:     Cleared if DPT created successfully
    2222;               Set if any error
     
    202202;----------------------------------------------------------------------
    203203; Update drive counts (hard and floppy)
    204 ;---------------------------------------------------------------------- 
    205        
     204;----------------------------------------------------------------------
     205
    206206%ifdef MODULE_SERIAL_FLOPPY
    207207;
    208208; These two instructions serve two purposes:
    209209; 1. If the drive is a floppy drive (CF set), then we effectively increment the counter.
    210 ; 2. If this is a hard disk, and there have been any floppy drives previously added, then the hard disk is 
     210; 2. If this is a hard disk, and there have been any floppy drives previously added, then the hard disk is
    211211;    effectively discarded.  This is more of a safety check then code that should ever normally be hit (see below).
    212 ;    Since the floppy DPT's come after the hard disk DPT's, without expensive (code size) code to relocate a DPT, 
     212;    Since the floppy DPT's come after the hard disk DPT's, without expensive (code size) code to relocate a DPT,
    213213;    this was necessary.  Now, this situation shouldn't happen in normal operation, for a couple of reasons:
    214 ;       A. xtidecfg always puts configured serial ports at the end fo the IDEVARS list
     214;       A. xtidecfg always puts configured serial ports at the end of the IDEVARS list
    215215;       B. the auto serial code is always executed last
    216216;       C. the serial server always returns floppy drives last
    217217;
    218218    adc     byte [RAMVARS.xlateVars+XLATEVARS.bFlopCreateCnt], 0
    219     jnz     .AllDone   
     219    jnz     .AllDone
    220220%else
    221221;
    222222; Even without floppy support enabled, we shouldn't try to mount a floppy image as a hard disk, which
    223 ; could lead to unpredictable results since no MBR will be present, etc.  The server doesn't know that 
     223; could lead to unpredictable results since no MBR will be present, etc.  The server doesn't know that
    224224; floppies are supported, so it is important to still fail here if a floppy is seen during the drive scan.
    225225;
     
    228228
    229229    inc     BYTE [RAMVARS.bDrvCnt]      ; Increment drive count to RAMVARS
    230        
    231 .AllDone:               
     230
     231.AllDone:
    232232    clc
    233233    ret
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm

    r277 r294  
    88; Checks if drive is handled by this BIOS, and return DPT pointer.
    99;
    10 ; FindDPT_ForDriveNumberInDL       
     10; FindDPT_ForDriveNumberInDL
    1111;   Parameters:
    1212;       DL:     Drive number
     
    2121;--------------------------------------------------------------------
    2222ALIGN JUMP_ALIGN
    23 FindDPT_ForDriveNumberInDL:     
     23FindDPT_ForDriveNumberInDL:
    2424    xchg    di, ax                              ; Save the contents of AX in DI
    2525
    26 ; 
     26;
    2727; Check Our Hard Disks
    2828;
     
    3333    cmp     dl, ah                              ; Above last supported?
    3434    jae     SHORT .HardDiskNotHandledByThisBIOS
    35        
     35
    3636    cmp     dl, al                              ; Below first supported?
    3737    jae     SHORT .CalcDPTForDriveNumber
    3838
    39 ALIGN JUMP_ALIGN               
    40 .HardDiskNotHandledByThisBIOS: 
     39ALIGN JUMP_ALIGN
     40.HardDiskNotHandledByThisBIOS:
    4141;
    4242; Check Our Floppy Disks
    43 ; 
     43;
    4444    call    RamVars_UnpackFlopCntAndFirstToAL
    4545    js      SHORT .DiskIsNotHandledByThisBIOS
    46                
     46
    4747    cbw                                         ; Always 0h (no floppy drive covered above)
    4848    adc     ah, al                              ; Add in first drive number and number of drives
     
    5151    jz      SHORT .CalcDPTForDriveNumber
    5252    cmp     al, dl                              ; Check first drive in all cases, redundant but OK to repeat
    53     jnz     SHORT .DiskIsNotHandledByThisBIOS           
     53    jnz     SHORT .DiskIsNotHandledByThisBIOS
    5454%else
    55     cmp     dl, ah                              ; Above last supported?     
     55    cmp     dl, ah                              ; Above last supported?
    5656    jae     SHORT .DiskIsNotHandledByThisBIOS
    57        
     57
    5858    cmp     dl, al                              ; Below first supported?
    59     jb      SHORT .DiskIsNotHandledByThisBIOS           
     59    jb      SHORT .DiskIsNotHandledByThisBIOS
    6060%endif
    6161    ; fall-through to CalcDPTForDriveNumber
     
    6363;--------------------------------------------------------------------
    6464; Finds Disk Parameter Table for drive number.
    65 ; Note intended to be called except by FindDPT_ForDriveNumber
     65; Not intended to be called except by FindDPT_ForDriveNumberInDL
    6666;
    6767; CalcDPTForDriveNumber
     
    6969;       DL:     Drive number
    7070;       DS:     RAMVARS segment
    71 ;       DI:     Saved copy of AX from entry at FindDPT_ForDriveNumber
     71;       DI:     Saved copy of AX from entry at FindDPT_ForDriveNumberInDL
    7272;   Returns:
    7373;       DS:DI:  Ptr to DPT
     
    8282%ifdef MODULE_SERIAL_FLOPPY
    8383    mov     ax, [RAMVARS.wDrvCntAndFirst]
    84        
     84
    8585    test    dl, dl
    8686    js      .harddisk
     
    8888    call    RamVars_UnpackFlopCntAndFirstToAL
    8989    add     dl, ah                      ; add in end of hard disk DPT list, floppies start immediately after
    90        
    91 ALIGN JUMP_ALIGN               
     90
     91ALIGN JUMP_ALIGN
    9292.harddisk:
    9393    sub     dl, al                      ; subtract off beginning of either hard disk or floppy list (as appropriate)
     
    9696%endif
    9797
    98 .CalcDPTForNewDrive:               
     98.CalcDPTForNewDrive:
    9999    mov     al, LARGEST_DPT_SIZE
    100        
     100
    101101    mul     dl
    102     add     ax, BYTE RAMVARS_size       ; Clears CF (will not oveflow)
     102    add     ax, BYTE RAMVARS_size       ; Clears CF (will not overflow)
    103103
    104104    pop     dx
     
    107107    ret
    108108
    109 ALIGN JUMP_ALIGN       
    110 .DiskIsNotHandledByThisBIOS:           
     109ALIGN JUMP_ALIGN
     110.DiskIsNotHandledByThisBIOS:
    111111;
    112112; Drive not found...
    113113;
    114114    xor     ax, ax                              ; Clear DPT pointer
    115     stc                                         ; Is not supported by our BIOS     
    116        
     115    stc                                         ; Is not supported by our BIOS
     116
    117117    xchg    di, ax                              ; Restore AX from save at top
    118118    ret
     
    136136
    137137;--------------------------------------------------------------------
    138 ; Iteration routine for FindDPT_ForIdevarsOffsetInDL, 
     138; Iteration routine for FindDPT_ForIdevarsOffsetInDL,
    139139; for use with IterateAllDPTs
    140 ; 
     140;
    141141; Returns when DPT is found on the controller with Idevars offset in DL
    142142;
     
    148148;               Set if wrong DPT
    149149;--------------------------------------------------------------------
    150 IterateFindFirstDPTforIdevars:     
     150IterateFindFirstDPTforIdevars:
    151151    cmp     dl, [di+DPT.bIdevarsOffset]         ; Clears CF if matched
    152152    je      .done
    153153    stc                                         ; Set CF for not found
    154 .done: 
     154.done:
    155155    ret
    156156
     
    171171FindDPT_ForNewDriveToDSDI:
    172172    push    dx
    173        
     173
    174174%ifdef MODULE_SERIAL_FLOPPY
    175175    mov     dx, [RAMVARS.wDrvCntAndFlopCnt]
     
    178178    mov     dl, [RAMVARS.bDrvCnt]
    179179%endif
    180        
     180
    181181    jmp     short FindDPT_ForDriveNumberInDL.CalcDPTForNewDrive
    182182
     
    185185;   Parameters:
    186186;       DS:DI:  Ptr to DPT to examine
    187 ;       BL:     Bit(s) to test in DPT.bFlagsHigh 
     187;       BL:     Bit(s) to test in DPT.bFlagsHigh
    188188;   Returns:
    189189;       CF:     Clear if wanted DPT found
     
    193193;--------------------------------------------------------------------
    194194ALIGN JUMP_ALIGN
    195 IterateToDptWithFlagsHighInBL:     
    196     test    BYTE [di+DPT.bFlagsHigh], bl        ; Clears CF
     195IterateToDptWithFlagsHighInBL:
     196    test    [di+DPT.bFlagsHigh], bl             ; Clears CF
    197197    jnz     SHORT .ReturnRightDPT
    198198    stc
    199 .ReturnRightDPT:       
     199.ReturnRightDPT:
    200200    ret
    201201
     
    212212;--------------------------------------------------------------------
    213213%ifdef MODULE_SERIAL
    214 ALIGN JUMP_ALIGN       
    215 FindDPT_ToDSDIforSerialDevice:         
     214ALIGN JUMP_ALIGN
     215FindDPT_ToDSDIforSerialDevice:
    216216    mov     bl, FLGH_DPT_SERIAL_DEVICE
    217217; fall-through
    218218%endif
    219                
     219
    220220;--------------------------------------------------------------------
    221221; FindDPT_ToDSDIforFlagsHigh
     
    231231;--------------------------------------------------------------------
    232232ALIGN JUMP_ALIGN
    233 FindDPT_ToDSDIforFlagsHighInBL:     
     233FindDPT_ToDSDIforFlagsHighInBL:
    234234    mov     si, IterateToDptWithFlagsHighInBL
    235235    ; Fall to IterateAllDPTs
     
    257257
    258258    mov     di, RAMVARS_size            ; Point DS:DI to first DPT
    259        
    260     mov     cl, [RAMVARS.bDrvCnt]
    261     xor     ch, ch                      ; Clears CF 
    262        
     259    eMOVZX  cx, [RAMVARS.bDrvCnt]
    263260    jcxz    .NotFound                   ; Return if no drives
    264        
     261
    265262ALIGN JUMP_ALIGN
    266263.LoopWhileDPTsLeft:
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm

    r270 r294  
    125125ALIGN JUMP_ALIGN
    126126RamVars_GetHardDiskCountFromBDAtoAX:
    127     push    es
    128 
    129     LOAD_BDA_SEGMENT_TO es, ax
    130127    call    RamVars_GetCountOfKnownDrivesToAX
    131     mov     cl, [es:BDA.bHDCount]
     128    push    ds
     129    LOAD_BDA_SEGMENT_TO ds, cx
     130    mov     cl, [BDA.bHDCount]
    132131    MAX_U   al, cl
    133        
    134     pop     es
     132    pop     ds
    135133    ret
    136134
     
    151149    cbw
    152150    ret
    153    
     151
    154152;--------------------------------------------------------------------
    155153; RamVars_GetIdeControllerCountToCX
     
    163161ALIGN JUMP_ALIGN
    164162RamVars_GetIdeControllerCountToCX:
    165     eMOVZX  cx, BYTE [cs:ROMVARS.bIdeCnt]
     163    eMOVZX  cx, [cs:ROMVARS.bIdeCnt]
    166164    ret
    167165
     
    177175;   Corrupts registers:
    178176;       Nothing
    179 ;--------------------------------------------------------------------       
     177;--------------------------------------------------------------------
    180178ALIGN JUMP_ALIGN
    181179RamVars_UnpackFlopCntAndFirstToAL:
    182180    mov     al, [RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst]
    183     sar     al, 1       
     181    sar     al, 1
    184182    ret
    185183%endif
Note: See TracChangeset for help on using the changeset viewer.