Changeset 233 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS_Configurator_v2


Ignore:
Timestamp:
Feb 4, 2012, 6:21:22 PM (12 years ago)
Author:
gregli@…
google:author:
gregli@hotmail.com
Message:

Serial Port: split single byte port and baud into two bytes, taking advantage of the two bytes in DPT_SERIAL, which supports more serial baud rates and in particular fixed a bug where a 4x client machine couldn't talk to a 115.2K server machine. This is a wide change, touching lots of files, but most are shallow changes. DetectPrint.asm took the most significant changes, now it calculates the baud rate to display instead of using characters provided by the Configurator. The Configurator now has a new menu flag, FLG_MENUITEM_CHOICESTRINGS, for specifying that values are not linear and they should be lookedup rather than indexed. Finally, another important bug fixed here is that in some error cases, the serial port code could get into an infinite loop waiting ont the hardware; now it has a timeout.

Location:
trunk/XTIDE_Universal_BIOS_Configurator_v2
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Inc/Help/IDE_SerialBaud.txt

    r202 r233  
    1 Supported baud rates are 2400, 9600, 38.4K, and 115.2K. The server must also be set to this same speed. Older UARTs may only support 2400 and 9600 baud, but sometimes can be pushed to 38.4K. 115.2K will likely only be possible with a newer UART that inclues a FIFO. Some high speed serial ports include UART clock multipliers, allowing for speeds at 230.4K (2x multiplier) and 460.8K (4x multiplier). These high speeds are supported by these BIOS, even on original 4.77MHz 8088 systems. Note that UART clock multipliers are not detectable by the software and 115.2K will still be used during configuration for high speeds; but if a multiplier is used, the actual speed (including the multiplier) will need to be used on the server.
     1Supported baud rates are 2400, 4800, 9600, 19.2K, 28.8K, 38.4K, 57.6K, and 115.2K. The server must also be set to this same speed. Older UARTs may only support up to 9600 baud, but sometimes can be pushed to 38.4K. 115.2K will likely only be possible with a newer UART that inclues a FIFO. Some high speed serial ports include UART clock multipliers, allowing for speeds at 230.4K (2x multiplier) and 460.8K (4x multiplier) above 115.2K. These high speeds are supported by these BIOS, even on original 4.77MHz 8088 systems. Note that UART clock multipliers are not detectable by the software and 115.2K will still be used during configuration for high speeds; but if a multiplier is used, the actual speed (including the multiplier) will need to be used by the server.
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Inc/Help/IDE_SerialCOM.txt

    r202 r233  
    1 Select a serial port by COM port number. COM1 through COM4 have well established I/O port assignments, COM5 and onward are less well established. "COMA" represents COM10, "COMB" represents COM11, and "COMC" represents COM12. Selecting COMx enables the manual selection of an I/O port address.
     1Select a serial port by COM port number. COM1 through COM4 have well established I/O port assignments, COM5 and onward are less well established. "COMA" represents COM10, "COMB" represents COM11, and "COMC" represents COM12. Selecting "COMx" enables the manual selection of an I/O port address.
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Inc/Help/IDE_SerialPort.txt

    r203 r233  
    1 Select a serial port by I/O address. Supported values are between 240h and 430h, and must be on an 8-byte boundary. If the entered value corresponds to one of the established COM port numbers, then the selection of serial port will use COM numbers instead.
     1Select a serial port by I/O address. Any port address is supported up to 3f8h, but must be on an 8-byte boundary. If the entered value corresponds to one of the established COM port numbers, then the selection will snap to that COM port and "COMx" must be selected again for custom I/O address entry.
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Inc/MenuStructs.inc

    r199 r233  
    3030FLG_MENUITEM_BYTEVALUE      EQU (1<<3)  ; Item value is single byte
    3131FLG_MENUITEM_PROGRAMVAR     EQU (1<<4)  ; Item is for configuring program, not BIOS
     32FLG_MENUITEM_CHOICESTRINGS  EQU (1<<5)  ; ChoiceToStringLookup table is 1-1 with ChoiceToValueLookup table,
     33                                        ; ChoiceToStringLookup table must also NULL terminated
    3234
    3335; Values for MENUITEM.bType
     
    4749    .rgwChoiceToValueLookup resb    2   ; Ptr to lookup table for translating selected choice to actual value
    4850    .rgszValueToStringLookup:           ; Ptr to lookup table for translating value to string
     51    .rgszChoiceToStringLookup:
    4952    .wMinValue              resb    2   ; Minimum allowed integer value
    5053    .wMaxValue:
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menuitem.asm

    r199 r233  
    289289    mov     ax, [es:di]
    290290
     291    test    BYTE [si+MENUITEM.bFlags], FLG_MENUITEM_BYTEVALUE
     292    jz      SHORT .NoConvertWordToByteValue
     293    xor     ah, ah              ; conversion needs to happen before call to the reader,
     294                                ; in case the reader unpacks the byte to a word
     295       
     296.NoConvertWordToByteValue:
    291297    mov     bx, [si+MENUITEM.itemValue+ITEM_VALUE.fnValueReader]
    292298    test    bx,bx
     
    300306    pop     es
    301307
    302     test    BYTE [si+MENUITEM.bFlags], FLG_MENUITEM_BYTEVALUE
    303     jnz     SHORT .ConvertWordToByteValue
    304308    test    BYTE [si+MENUITEM.bFlags], FLG_MENUITEM_FLAGVALUE
    305309    jz      SHORT .Return
     
    309313    jnz     SHORT .Return
    310314    xor     ax, ax
    311 ALIGN JUMP_ALIGN
    312 .ConvertWordToByteValue:
    313     xor     ah, ah
     315
    314316ALIGN JUMP_ALIGN, ret
    315317.Return:
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/MenuitemPrint.asm

    r107 r233  
    156156ALIGN JUMP_ALIGN
    157157MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI:
     158MenuitemPrint_WriteLookupValueStringToBufferInESDIfromRawItemInDSSI:
    158159    call    Menuitem_GetValueToAXfromMenuitemInDSSI
    159160    ; Fall to PrintLookupValueFromAXtoBufferInESDI
     
    173174PrintLookupValueFromAXtoBufferInESDI:
    174175    push    si
     176    test    byte [si+MENUITEM.bFlags], FLG_MENUITEM_CHOICESTRINGS
     177    jnz     .lookupChoice   
     178       
    175179    add     ax, [si+MENUITEM.itemValue+ITEM_VALUE.rgszValueToStringLookup]
    176180    xchg    bx, ax
     181.found:
    177182    mov     si, [bx]
     183.errorReturn:
    178184    call    String_CopyDSSItoESDIandGetLengthToCX
    179185    pop     si
    180186    ret
    181187
     188;
     189; With FLG_MENUITEM_CHOICESTRINGS, the array at .rgszChoiceToStringLookup is based on the
     190; Choice number (offset within .rgwChoiceToValueLookup) instead of the value stored.
     191; Here, we scan the .rgwChoiceToValueLookup array until we find the value there, and then
     192; use the same offset in .rgszChoiceToStringLookup.  If we don't find the value, we
     193; return an "Error!" string instead. 
     194;
     195; Note that the pointer array at .rgszChoiceToStringLookup must be NULL terminated.  Since the
     196; value could be zero, we don't use the .rgwChoiceToValueLookup array to find the end.
     197;
     198.lookupChoice:
     199    mov     bx,[si+MENUITEM.itemValue+ITEM_VALUE.rgszChoiceToStringLookup]     
     200    mov     si,[si+MENUITEM.itemValue+ITEM_VALUE.rgwChoiceToValueLookup]
     201       
     202.wordLoop:
     203    cmp     ax,[si]
     204    jz      .found
     205    inc     si
     206    inc     si
     207    inc     bx
     208    inc     bx
     209    cmp     word [bx],0
     210    jnz     .wordLoop
     211
     212    mov     si,g_szValueUnknownError
     213    jmp     .errorReturn
    182214
    183215;--------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/IdeControllerMenu.asm

    r200 r233  
    4646istruc MENUITEM
    4747    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
    48     at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI
     48    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteLookupValueStringToBufferInESDIfromRawItemInDSSI
    4949    at  MENUITEM.szName,            dw  g_szItemIdeDevice
    5050    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeDevice
     
    9393istruc MENUITEM
    9494    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
    95     at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteLookupValueStringToBufferInESDIfromUnshiftedItemInDSSI
     95    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteLookupValueStringToBufferInESDIfromRawItemInDSSI
    9696    at  MENUITEM.szName,            dw  g_szItemSerialCOM
    9797    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeSerialCOM
    9898    at  MENUITEM.szHelp,            dw  g_szHelpIdeSerialCOM
    99     at  MENUITEM.bFlags,            db  FLG_MENUITEM_MODIFY_MENU
     99    at  MENUITEM.bFlags,            db  FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_BYTEVALUE | FLG_MENUITEM_CHOICESTRINGS
    100100    at  MENUITEM.bType,             db  TYPE_MENUITEM_MULTICHOICE
    101101    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  NULL
    102102    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgDevice
    103103    at  MENUITEM.itemValue + ITEM_VALUE.szMultichoice,              dw  g_szSerialCOMChoice
    104     at  MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup,     dw  NULL
    105     at  MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup,    dw  g_rgszValueToStringLookupForCOM
    106     at  MENUITEM.itemValue + ITEM_VALUE.fnValueReader,              dw  IdeControllerMenu_SerialReadCOM 
     104    at  MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup,     dw  g_rgbChoiceToValueLookupForCOM
     105    at  MENUITEM.itemValue + ITEM_VALUE.rgszChoiceToStringLookup,   dw  g_rgszChoiceToStringLookupForCOM
    107106    at  MENUITEM.itemValue + ITEM_VALUE.fnValueWriter,              dw  IdeControllerMenu_SerialWriteCOM
    108107iend
     
    115114    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeSerialPort
    116115    at  MENUITEM.szHelp,            dw  g_szHelpIdeSerialPort
    117     at  MENUITEM.bFlags,            db  FLG_MENUITEM_MODIFY_MENU       
     116    at  MENUITEM.bFlags,            db  FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_BYTEVALUE
    118117    at  MENUITEM.bType,             db  TYPE_MENUITEM_HEX
    119118    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  NULL
    120119    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgIdeCmdPort
    121     at  MENUITEM.itemValue + ITEM_VALUE.wMinValue,                  dw  DEVICE_SERIAL_PACKEDPORTANDBAUD_MINPORT
    122     at  MENUITEM.itemValue + ITEM_VALUE.wMaxValue,                  dw  DEVICE_SERIAL_PACKEDPORTANDBAUD_MAXPORT
     120    at  MENUITEM.itemValue + ITEM_VALUE.wMinValue,                  dw  8h
     121    at  MENUITEM.itemValue + ITEM_VALUE.wMaxValue,                  dw  3f8h
    123122    at  MENUITEM.itemValue + ITEM_VALUE.fnValueReader,              dw  IdeControllerMenu_SerialReadPort
    124123    at  MENUITEM.itemValue + ITEM_VALUE.fnValueWriter,              dw  IdeControllerMenu_SerialWritePort
     
    128127istruc MENUITEM
    129128    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
    130     at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteLookupValueStringToBufferInESDIfromUnshiftedItemInDSSI
     129    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteLookupValueStringToBufferInESDIfromRawItemInDSSI
    131130    at  MENUITEM.szName,            dw  g_szItemSerialBaud
    132131    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeSerialBaud
    133132    at  MENUITEM.szHelp,            dw  g_szHelpIdeSerialBaud
     133    at  MENUITEM.bFlags,            db  FLG_MENUITEM_BYTEVALUE | FLG_MENUITEM_CHOICESTRINGS
    134134    at  MENUITEM.bType,             db  TYPE_MENUITEM_MULTICHOICE
    135135    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  NULL
    136136    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgDevice
    137137    at  MENUITEM.itemValue + ITEM_VALUE.szMultichoice,              dw  g_szSerialBaudChoice
    138     at  MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup,     dw  NULL
    139     at  MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup,    dw  g_rgszValueToStringLookupForBaud
    140     at  MENUITEM.itemValue + ITEM_VALUE.fnValueReader,              dw  IdeControllerMenu_SerialReadBaud
    141     at  MENUITEM.itemValue + ITEM_VALUE.fnValueWriter,              dw  IdeControllerMenu_SerialWriteBaud
     138    at  MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup,     dw  g_rgbChoiceToValueLookupForBaud
     139    at  MENUITEM.itemValue + ITEM_VALUE.rgszChoiceToStringLookup,   dw  g_rgszChoiceToStringLookupForBaud
    142140iend
    143141       
     
    188186    dw  g_szValueCfgDeviceSerial
    189187
    190 g_rgszValueToStringLookupForCOM:       
     188g_rgbChoiceToValueLookupForCOM:
     189    dw  '1'
     190    dw  '2'
     191    dw  '3'
     192    dw  '4'
     193    dw  '5'
     194    dw  '6'
     195    dw  '7'
     196    dw  '8'
     197    dw  '9'
     198    dw  'A'
     199    dw  'B'
     200    dw  'C'
     201    dw  'x'             ; must be last entry (see reader/write routines)
     202g_rgszChoiceToStringLookupForCOM:       
    191203    dw  g_szValueCfgCOM1
    192204    dw  g_szValueCfgCOM2
     
    202214    dw  g_szValueCfgCOMC
    203215    dw  g_szValueCfgCOMx
    204 
    205 g_rgszValueToStringLookupForBaud:
    206     dw  g_szValueCfgBaud2400
    207     dw  g_szValueCfgBaud9600
    208     dw  g_szValueCfgBaud38_4
    209     dw  g_szValueCfgBaud115_2
    210 
    211 g_wPrintBaud:
    212     dw  DEVICE_SERIAL_PRINTBAUD_2400
    213     dw  DEVICE_SERIAL_PRINTBAUD_9600
    214     dw  DEVICE_SERIAL_PRINTBAUD_38_4
    215     dw  DEVICE_SERIAL_PRINTBAUD_115_2
     216    dw  NULL
     217
     218DEVICE_SERIAL_DEFAULT_CUSTOM_PORT   EQU     300h           ; can't be any of the pre-defined COM values
     219
     220PackedCOMPortAddresses:             ; COM1 - COMC (or COM12)
     221    db      DEVICE_SERIAL_COM1 >> 2
     222    db      DEVICE_SERIAL_COM2 >> 2
     223    db      DEVICE_SERIAL_COM3 >> 2
     224    db      DEVICE_SERIAL_COM4 >> 2
     225    db      DEVICE_SERIAL_COM5 >> 2
     226    db      DEVICE_SERIAL_COM6 >> 2
     227    db      DEVICE_SERIAL_COM7 >> 2
     228    db      DEVICE_SERIAL_COM8 >> 2
     229    db      DEVICE_SERIAL_COM9 >> 2
     230    db      DEVICE_SERIAL_COMA >> 2
     231    db      DEVICE_SERIAL_COMB >> 2
     232    db      DEVICE_SERIAL_COMC >> 2
     233    db      DEVICE_SERIAL_DEFAULT_CUSTOM_PORT >> 2          ; must be last entry (see reader/writer routines)
     234DEVICE_SERIAL_DEFAULT_COM           EQU     '1'
     235       
     236g_rgbChoiceToValueLookupForBaud:
     237    dw      (115200 / 115200) & 0xff
     238    dw      (115200 /  57600) & 0xff
     239    dw      (115200 /  38400) & 0xff
     240    dw      (115200 /  28800) & 0xff
     241    dw      (115200 /  19200) & 0xff
     242    dw      (115200 /   9600) & 0xff
     243    dw      (115200 /   4800) & 0xff
     244    dw      (115200 /   2400) & 0xff
     245g_rgszChoiceToStringLookupForBaud:
     246    dw      g_szValueCfgBaud115_2
     247    dw      g_szValueCfgBaud57_6
     248    dw      g_szValueCfgBaud38_4
     249    dw      g_szValueCfgBaud28_8
     250    dw      g_szValueCfgBaud19_2
     251    dw      g_szValueCfgBaud9600
     252    dw      g_szValueCfgBaud4800
     253    dw      g_szValueCfgBaud2400
     254    dw      NULL
     255DEVICE_SERIAL_DEFAULT_BAUD          EQU     ((115200 / 9600)    & 0xff)
    216256
    217257; Section containing code
     
    240280    lea     ax, [bx+IDEVARS.wPort]
    241281    mov     [cs:g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
     282       
     283    lea     ax, [bx+IDEVARS.bSerialPort]       
    242284    mov     [cs:g_MenuitemIdeControllerSerialPort+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
    243     mov     [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax     
     285
     286    lea     ax, [bx+IDEVARS.bSerialBaud]
    244287    mov     [cs:g_MenuitemIdeControllerSerialBaud+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
    245                 ;; baud also modifies the next two bytes (print chars in wPortCtrl), but it never reads them
    246288       
    247289    lea     ax, [bx+IDEVARS.wPortCtrl]
    248290    mov     [cs:g_MenuitemIdeControllerControlBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
     291       
     292    lea     ax, [bx+IDEVARS.bSerialCOMPortChar]
     293    mov     [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax             
    249294
    250295    lea     ax, [bx+IDEVARS.bIRQ]
     
    382427ALIGN JUMP_ALIGN
    383428DisplayMasterSlaveMenu:
     429;
     430; block mode is not supported on serial drives, disable/enable the option as appropriate
     431;
     432    push    bx
     433    mov     bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]       
     434    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
     435    mov     bx, g_MenuitemMasterSlaveBlockModeTransfers
     436    cmp     al,DEVICE_SERIAL_PORT
     437    jz      .isSerial
     438    or      BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
     439    jmp     .isDone
     440.isSerial:     
     441    and     BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
     442.isDone:
     443    pop     bx
     444           
    384445    call    MasterSlaveMenu_InitializeToDrvparamsOffsetInBX
    385446    jmp     MasterSlaveMenu_EnterMenuOrModifyItemVisibility
    386 
    387 PackedCOMPortAddresses:             ; COM1 - COMC (or COM12)
    388     db      (DEVICE_SERIAL_COM1 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1
    389     db      (DEVICE_SERIAL_COM2 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1
    390     db      (DEVICE_SERIAL_COM3 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1
    391     db      (DEVICE_SERIAL_COM4 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1   
    392     db      (DEVICE_SERIAL_COM5 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1
    393     db      (DEVICE_SERIAL_COM6 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1
    394     db      (DEVICE_SERIAL_COM7 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1   
    395     db      (DEVICE_SERIAL_COM8 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1   
    396     db      (DEVICE_SERIAL_COM9 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1
    397     db      (DEVICE_SERIAL_COMA - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1   
    398     db      (DEVICE_SERIAL_COMB - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1
    399     db      (DEVICE_SERIAL_COMC - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1 
    400     db      0                       ; null terminated
    401447
    402448;------------------------------------------------------------------------------------------
     
    474520        jz      .done                               ; if we were already serial, nothing to do
    475521
    476         mov     ax,DEVICE_SERIAL_DEFAULT_COM
     522        mov     byte [es:di+IDEVARS.bSerialBaud-IDEVARS.wPort],DEVICE_SERIAL_DEFAULT_BAUD
     523
     524        mov     al,DEVICE_SERIAL_DEFAULT_COM
     525        add     di,IDEVARS.bSerialCOMPortChar-IDEVARS.wPort
    477526        call    IdeControllerMenu_SerialWriteCOM
    478         mov     [es:di],ax
    479        
    480         mov     ax,DEVICE_SERIAL_DEFAULT_BAUD
    481         call    IdeControllerMenu_SerialWriteBaud
    482         mov     [es:di],ax
     527        mov     [es:di],al
    483528               
    484         add     di,IDEVARS.bIRQ - IDEVARS.wPort     ; clear out the interrupt information, we don't use interrupts
    485         mov     al,0
    486         mov     [es:di],al
    487 
    488529.done: 
    489530        pop     di
     
    494535
    495536;
    496 ; "COMn" ASCII characer -> Numeric COM number
    497 ;
    498 ALIGN JUMP_ALIGN
    499 IdeControllerMenu_SerialReadCOM:
    500         xor     ah,ah                               ; clear out packedportbaud value
    501 
    502         cmp     al,'x'                              ; base this on the ASCII character used to print
    503         jz      .custom
    504 
    505         cmp     al,'A'
    506         jae     .over10
    507 
    508         sub     al, '0'+1                           ; convert ASCII value '0'-'9' to numeric
     537; Doesn't modify COM character (unless it is not recognized, which would be an error case),
     538; But does update the port address based on COM port selection 
     539;               
     540ALIGN JUMP_ALIGN
     541IdeControllerMenu_SerialWriteCOM:
     542        push    ax
     543        push    bx
     544        push    si
     545       
     546        mov     si,g_rgbChoiceToValueLookupForCOM
     547        mov     bx,PackedCOMPortAddresses
     548
     549.loop:
     550        mov     ah,[bx]
     551
     552        cmp     ah,(DEVICE_SERIAL_DEFAULT_CUSTOM_PORT >> 2)
     553        jz      .notFound
     554       
     555        cmp     al,[si]
     556        jz      .found
     557       
     558        inc     si
     559        inc     si
     560        inc     bx
     561       
     562        jmp     .loop
     563
     564.notFound:
     565        mov     al, 'x'
     566       
     567.found:         
     568        mov     [es:di+IDEVARS.bSerialPort-IDEVARS.bSerialCOMPortChar], ah
     569
     570        pop     si
     571        pop     bx
     572        pop     ax
     573       
    509574        ret
    510 
    511 .over10:
    512         sub     al, 'A'-10+1                        ; convert ASCII value 'A'-'C' to numeric
     575       
     576
     577;
     578; Packed Port (byte) -> Numeric Port (word)
     579;               
     580ALIGN JUMP_ALIGN
     581IdeControllerMenu_SerialReadPort:
     582        xor     ah,ah
     583        shl     ax,1
     584        shl     ax,1
    513585        ret
    514586
    515 .custom:
    516         mov     al, 12                              ; convert ASCII value 'x' (for custom) to numeric
    517         ret
    518 
    519 ;
    520 ; Numeric COM number -> Packed port address, and update ASCII character for printing "COMn"
    521 ;               
    522 ALIGN JUMP_ALIGN
    523 IdeControllerMenu_SerialWriteCOM:
    524         push    bx
    525 
    526         cmp     al,12                               ; custom?
    527         jge     .custom
    528 
    529         mov     bx,ax                               ; lookup packed port address based on COM address
    530         mov     ah,[cs:bx+PackedCOMPortAddresses]
    531 
    532         cmp     al,9                                ; COMA or higher, but not custom
    533         jge     .atorabove10
    534 
    535         add     al, '0'+1                           ; convert numeric to ASCII '1' to '9'
    536         jmp     IdeControllerMenu_SerialWriteCOM_PackAndRet
    537 
    538 .custom:
    539         mov     al,'x'                              ; ASCII value 'x' for custom
    540         mov     ah,1 << DEVICE_SERIAL_PACKEDPORTANDBAUD_PORT_FIELD_POSITION ; 248h
    541         jmp     IdeControllerMenu_SerialWriteCOM_PackAndRet
    542 
    543 .atorabove10:
    544         add     al, 'A'-10+1                        ; convert numeric to ASCII 'A' to 'C'
    545 
    546 IdeControllerMenu_SerialWriteCOM_PackAndRet:
    547         mov     bl,[es:di+1]                        ; read baud rate bits
    548         and     bl,DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDMASK     
    549         or      ah,bl
    550 
    551         pop     bx
    552         ret     
    553 
    554 ;
    555 ; Packed Baud -> Numeric Baud
    556 ;               
    557 ALIGN JUMP_ALIGN
    558 IdeControllerMenu_SerialReadBaud:
    559         xchg    al,ah
    560         and     ax,DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDMASK         ; also clears high order byte
    561         ret
    562 
    563 ;
    564 ; Numeric Baud -> Packed Baud, also update ASCII printing characters for baud rate
    565 ;               
    566 ALIGN JUMP_ALIGN
    567 IdeControllerMenu_SerialWriteBaud:
    568         and     ax,DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDBITS         ; ensure we only have the bits we want
    569        
    570         push    bx
    571 
    572         mov     bx,ax                                               ; lookup printing word for wPortCtrl
    573         shl     bx,1
    574         mov     bx,[cs:bx+g_wPrintBaud]
    575         mov     [es:di+2],bx
    576 
    577         xchg    al,ah                                               ; or in port bits
    578         mov     bx,[es:di]
    579         and     bh,DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTMASK
    580         or      ax,bx
    581 
    582         pop     bx
    583         ret
    584 
    585 ;
    586 ; Packed Port -> Numeric Port
    587 ;               
    588 ALIGN JUMP_ALIGN
    589 IdeControllerMenu_SerialReadPort:       
    590         mov     al,ah
    591         and     ax,DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTMASK         ; note that this clears AH
    592         shl     ax,1
    593         add     ax,DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT
    594         ret
    595 
    596 ;
    597 ; Numeric Port -> Packed Port, convert from Custom to a defined COM port if we match one
     587;
     588; Numeric Port (word) -> Packed Port (byte)
     589; And convert from Custom to a defined COM port if we match one of the pre-defined COM port numbers
    598590;
    599591ALIGN JUMP_ALIGN
    600592IdeControllerMenu_SerialWritePort:     
    601593        push    bx
    602 
    603         sub     ax,DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT     ; convert from numeric to packed port number
     594        push    si
     595
    604596        shr     ax,1
    605         and     al,DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTMASK
    606 
    607         mov     bx,PackedCOMPortAddresses                           ; loop, looking for port address in known COM address list
    608 .next: 
    609         mov     ah,[cs:bx]
     597        shr     ax,1
     598        and     al,0feh         ; force 8-byte boundary
     599
     600        mov     si,g_rgbChoiceToValueLookupForCOM                       
     601        mov     bx,PackedCOMPortAddresses           ; loop, looking for port address in known COM address list
     602
     603.loop:
     604        mov     ah,[si]
     605        cmp     ah,'x'
     606        jz      .found
     607               
     608        cmp     al,[bx]
     609        jz      .found
     610       
     611        inc     si
     612        inc     si
    610613        inc     bx
    611         test    ah,ah
    612         jz      .notfound
    613         cmp     al,ah
    614         jnz     .next
    615 
    616         sub     bx,PackedCOMPortAddresses + 1                       ; FOUND!, +1 since we already incremented
    617         mov     ax,bx
     614       
     615        jmp     .loop
     616
     617.found:
     618        mov     [es:di+IDEVARS.bSerialCOMPortChar-IDEVARS.bSerialPort], ah
     619
     620        pop     si
    618621        pop     bx
    619         jmp     IdeControllerMenu_SerialWriteCOM                    ; if found, use that logic to get ASCII character
    620 
    621 .notfound:
    622         xchg    ah,al                                               
    623         mov     al,'x'
    624         jmp     IdeControllerMenu_SerialWriteCOM_PackAndRet
    625 
    626 
     622
     623        ret
     624
     625
     626
     627
     628
     629
     630
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Strings.asm

    r203 r233  
    135135g_szNfoIdeSerialCOM:    db  "Select a COM port by number.",NULL
    136136g_szNfoIdeSerialBaud:   db  "Select the COM port's Baud Rate. The server must match this speed. Note that UART clock multipliers may impact the actual speed.",NULL
    137 g_szNfoIdeSerialPort:   db  "Select a COM port by custom I/O port address. Address must be in the range 248h to 430h and be on an 8-byte boundary.", NULL
     137g_szNfoIdeSerialPort:   db  "Select a COM port by custom I/O port address. Any address is valud up to 3f8h, but must be on an 8-byte boundary.", NULL
    138138
    139139g_szHelpIdeCmdPort:     incbin  "IDE_CommandPort.txt"
     
    161161
    162162g_szSerialCOMChoice:
    163                         db  "COM1 - Port 3f8h",LF
    164                         db  "COM2 - Port 2f8h",LF
    165                         db  "COM3 - Port 3e8h",LF
    166                         db  "COM4 - Port 2e8h",LF
    167                         db  "COM5 - Port 2f0h",LF
    168                         db  "COM6 - Port 3e0h",LF
    169                         db  "COM7 - Port 2e0h",LF
    170                         db  "COM8 - Port 260h",LF
    171                         db  "COM9 - Port 368h",LF
    172                         db  "COMA - Port 268h",LF
    173                         db  "COMB - Port 360h",LF
    174                         db  "COMC - Port 270h",LF
    175                         db  "COMx - Custom Port",NULL
     163                        db  "COM1 - address 3f8h",LF
     164                        db  "COM2 - address 2f8h",LF
     165                        db  "COM3 - address 3e8h",LF
     166                        db  "COM4 - address 2e8h",LF
     167                        db  "COM5 - address 2f0h",LF
     168                        db  "COM6 - address 3e0h",LF
     169                        db  "COM7 - address 2e0h",LF
     170                        db  "COM8 - address 260h",LF
     171                        db  "COM9 - address 368h",LF
     172                        db  "COMA - address 268h",LF
     173                        db  "COMB - address 360h",LF
     174                        db  "COMC - address 270h",LF
     175                        db  "COMx - Custom address",NULL
    176176
    177177g_szValueCfgCOM1:       db      "COM1",NULL
     
    190190       
    191191g_szSerialBaudChoice:
    192                         db  "2400 baud",LF
     192                        db  "115.2K baud",LF
     193                        db  "57.6K baud",LF
     194                        db  "38.4K baud",LF
     195                        db  "28.8K baud",LF
     196                        db  "19.2K baud",LF
    193197                        db  "9600 baud",LF
    194                         db  "38.4K baud",LF
    195                         db  "115.2K baud",NULL
    196 
     198                        db  "4800 baud",LF     
     199                        db  "2400 baud",NULL
     200
     201g_szValueCfgBaud115_2:  db      "115.2K",NULL
     202g_szValueCfgBaud57_6:   db      "57.6K",NULL
     203g_szValueCfgBaud38_4:   db      "38.4K",NULL
     204g_szValueCfgBaud28_8:   db      "28.8K",NULL
     205g_szValueCfgBaud19_2:   db      "19.2K",NULL
     206g_szValueCfgBaud9600:   db      "9600",NULL
     207g_szValueCfgBaud4800:   db      "4800",NULL     
    197208g_szValueCfgBaud2400:   db      "2400",NULL
    198 g_szValueCfgBaud9600:   db      "9600",NULL
    199 g_szValueCfgBaud38_4:   db      "38.4K",NULL
    200 g_szValueCfgBaud115_2:  db      "115.2K",NULL
     209
    201210       
    202211g_szValueCfgDeviceDual8b:   db  "XTIDE",NULL
     
    363372
    364373g_szDashForZero:        db      "- ",NULL
     374
     375g_szValueUnknownError:  db  "Error!",NULL
     376
     377
     378
Note: See TracChangeset for help on using the changeset viewer.