Changeset 233 in xtideuniversalbios


Ignore:
Timestamp:
Feb 4, 2012, 6:21:22 PM (13 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
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/Serial_Server/library/Image.cpp

    r219 r233  
    137137#define ATA_dwLBACnt 60
    138138
    139 #define ATA_VendorSpecific_ReturnPortBaud 158
     139#define ATA_wVendor 159
    140140
    141141#define ATA_wCaps_LBA 0x200
     
    164164};
    165165
    166 void Image::respondInquire( unsigned short *buff, struct baudRate *baudRate, unsigned char portAndBaud )
    167 {
    168     unsigned short comPort = 0;
    169     struct comPorts *cp;
    170 
    171     if( portAndBaud )
    172     {
    173         for( cp = supportedComPorts; cp->port && cp->port != ((portAndBaud << 3) + 0x260); cp++ ) ;
    174         if( cp->port )
    175             comPort = cp->com;
    176     }
    177      
     166void Image::respondInquire( unsigned short *buff, struct baudRate *baudRate, unsigned short port, unsigned char scan )
     167{
    178168    memset( &buff[0], 0, 514 );
    179169
    180     if( comPort )
    181         sprintf( (char *) &buff[ATA_strModel], "%.20s (COM%d/%s)", shortFileName, comPort, baudRate->display );
    182     else
    183         sprintf( (char *) &buff[ATA_strModel], "%.30s (%s baud)", shortFileName, baudRate->display );
    184 
    185     // strncpy( (char *) &buff[ATA_strModel], img->shortFileName, 40 );
     170    if( scan )
     171    {
     172        unsigned short comPort = 0;
     173        struct comPorts *cp;
     174
     175        if( port )
     176        {
     177            for( cp = supportedComPorts; cp->port && cp->port != port; cp++ ) ;
     178            if( cp->port )
     179                comPort = cp->com;
     180        }
     181
     182        if( comPort )
     183            sprintf( (char *) &buff[ATA_strModel], "%.15s (COM%c/%s)", shortFileName, comPort, baudRate->display );
     184        else
     185            sprintf( (char *) &buff[ATA_strModel], "%.25s (%s baud)", shortFileName, baudRate->display );
     186    }
     187    else
     188        sprintf( (char *) &buff[ATA_strModel], "%.30s", shortFileName );
    186189
    187190    strncpy( (char *) &buff[ATA_strSerial], "serial", 20 );
  • trunk/Serial_Server/library/Library.h

    r223 r233  
    4242    static int parseGeometry( char *str, unsigned long *p_cyl, unsigned long *p_head, unsigned long *p_sect );
    4343
    44     void respondInquire( unsigned short *buff, struct baudRate *baudRate, unsigned char portAndBaud );
     44    void respondInquire( unsigned short *buff, struct baudRate *baudRate, unsigned short port, unsigned char scan );
    4545
    4646    void init( char *name, int p_readOnly, int p_drive, unsigned long p_cyl, unsigned long p_head, unsigned long p_sect, int p_useCHS );
  • trunk/Serial_Server/library/Process.cpp

    r219 r233  
    3131        unsigned char driveAndHead;
    3232        unsigned char count;
    33         unsigned char undefined1;
    34         unsigned char portAndBaud;
    35         unsigned char undefined2;
     33        unsigned char scan;
     34        unsigned char port;
     35        unsigned char baud;
    3636    } inquire;
    3737    unsigned char b[514];
     
    4848#define SERIAL_COMMAND_MASK 0xe3
    4949#define SERIAL_COMMAND_HEADERMASK 0xe0
    50 
    51 #define SERIAL_INQUIRE_PORTANDBAUD_BAUDMASK 3
    52 #define SERIAL_INQUIRE_PORTANDBAUD_PORTMASK 0xfc
    53 #define SERIAL_INQUIRE_PORTANDBAUD_STARTINGPORT 0x240
    54 
    55 #define SERIAL_INQUIRE_PORTANDBAUD_PORTTRANSLATE( a ) ( ((a) & SERIAL_INQUIRE_PORTANDBAUD_PORT) << 1 | SERIAL_INQUIRE_PORTANDBAUD_STARTINGPORT )
    5650
    5751#define ATA_COMMAND_LBA 0x40
     
    9690    unsigned long cyl, sect, head;
    9791    unsigned long perfTimer;
     92    unsigned char lastScan;
    9893
    9994    GetTime_Timeout_Local = GetTime_Timeout();
     
    10297    readto = 0;
    10398    workCount = workOffset = workCommand = 0;
     99    lastScan = 0;
    104100
    105101    lasttick = GetTime();
     
    282278                    if( workCommand == SERIAL_COMMAND_INQUIRE )
    283279                        log( 1, "Inquire %d: Client Port=0x%x, Client Baud=%s", img == image0 ? 0 : 1,
    284                              ((buff.inquire.portAndBaud & SERIAL_INQUIRE_PORTANDBAUD_PORTMASK) << 1)
    285                              + SERIAL_INQUIRE_PORTANDBAUD_STARTINGPORT,
    286                              baudRateMatchDivisor( buff.inquire.portAndBaud & SERIAL_INQUIRE_PORTANDBAUD_BAUDMASK )->display );
     280                             ((unsigned short) buff.inquire.port) << 2,
     281                             baudRateMatchDivisor( buff.inquire.baud )->display );
    287282                    else if( buff.chs.driveAndHead & ATA_COMMAND_LBA )
    288283                        log( 1, "%s %d: LBA=%u, Count=%u", comStr, img == image0 ? 0 : 1,
     
    325320                if( workCommand == SERIAL_COMMAND_INQUIRE )
    326321                {
     322                    unsigned char localScan;
     323
    327324                    if( serial->speedEmulation &&
    328                         (buff.inquire.portAndBaud & SERIAL_INQUIRE_PORTANDBAUD_BAUDMASK) != serial->baudRate->divisor )
     325                        buff.inquire.baud != serial->baudRate->divisor )
    329326                    {
    330327                        log( 1, "    Ignoring Inquire with wrong baud rate" );
     
    333330                    }
    334331
    335                     img->respondInquire( &buff.w[0], serial->baudRate, buff.inquire.portAndBaud );
     332                    localScan = buff.inquire.scan;         // need to do this before the call to
     333                                                           // img->respondInquire, as it will clear the buff
     334                    img->respondInquire( &buff.w[0], serial->baudRate,
     335                                         ((unsigned short) buff.inquire.port) << 2,
     336                                         (img == image1 && lastScan) || buff.inquire.scan );
     337                    lastScan = localScan;
    336338                }
    337339                //
     
    342344                    img->seekSector( mylba + workOffset );
    343345                    img->readSector( &buff.w[0] );
     346                    lastScan = 0;
    344347                }
    345348
  • trunk/Serial_Server/library/Serial.cpp

    r215 r233  
    1212struct baudRate supportedBaudRates[] =
    1313{
    14     {   2400,  0x0,   "2400" },
    15     {   4800, 0xff,   "4800" },
    16     {   9600,  0x1,   "9600" },
    17     {  19200, 0xff,  "19.2K" },
    18     {  38400,  0x2,  "38.4K" },
    19     {  76800, 0xff,  "76.8K" },
    20     { 115200,  0x3, "115.2K" },
    21     { 153600, 0xff, "153.6K" },
    22     { 230400, 0xff, "230.4K" },
    23     { 460800, 0xff, "460.8K" },
    24     {      0,    0,     NULL }
     14    {   2400,  0x30,    "2400" },
     15    {   4800,  0x18,    "4800" },
     16    {   9600,   0xc,    "9600" },
     17    {  19200,  0xff,   "19.2K" },
     18    {  28800,   0x4,   "28.8K" },
     19    {  38400,  0xff,   "38.4K" },
     20    {  57600,   0x2,   "57.6K" },
     21    {  76800,  0xff,   "76.8K" },
     22    { 115200,   0x1,  "115.2K" },
     23    { 153600,  0xff,  "153.6K" },
     24    { 230400,  0xff,  "230.4K" },
     25    { 460800,  0xff,  "460.8K" },
     26    {      0,     0, "Unknown" },
    2527};
    2628
     
    3739    }
    3840
    39     return( NULL );
     41    return( b );
    4042}
    4143
     
    4749        ;
    4850
    49     return( b->rate ? b : NULL );
     51    return( b );
    5052}
    5153
  • trunk/Serial_Server/win32/Win32.cpp

    r225 r233  
    3232        "                      (default is a 32 MB disk, with CHS geometry 65:63:16)",
    3333        "",
    34         "  -p                  Named Pipe mode for emulators (pipe is '" PIPENAME "')",
     34        "  -p                  Named Pipe mode for emulators (pipe is \"" PIPENAME "\")",
    3535        "",
    3636        "  -c COMPortNumber    COM Port to use (default is first found)",
    3737        "",
    38         "  -b BaudRate         Baud rate to use on the COM port ",
    39         "                      Without a rate multiplier: 2400, 9600, 38400, 115200",
    40         "                      With a 2x rate multiplier: 4800, 19200, 76800, 230400",
    41         "                      With a 4x rate multiplier: 9600, 38400, 153600, 460800",
    42         "                      Abbreviations also accepted (ie, '460K', '38.4K', etc)",
    43         "                      (default is 38400, 115200 in named pipe mode)",
     38        "  -b BaudRate         Baud rate to use on the COM port, with client machine",
     39        "                      rate multiplier in effect:",
     40        "                          None:  2400,  4800,  9600,  28.8K,  57.6K, 115.2K",
     41        "                          2x:    4800,  9600, 19200,  57.6K, 115.2K, 230.4K",
     42        "                          4x:    9600, 19200, 38400, 115.2K, 230.4K, 460.8K",
     43        "                          and for completeness:               76.8K, 153.6K",
     44        "                      (default is 9600, 115.2K when in named pipe mode)",
    4445        "",
    4546        "  -t                  Disable timeout, useful for long delays when debugging",
     
    148149                break;
    149150            case 'b': case 'B':
    150                 if( !(baudRate = baudRateMatchString( argv[++t] )) )
    151                 {
    152                     fprintf( stderr, "Unknown Baud Rate %s\n\n", argv[t] );
    153                     usage();
    154                 }
     151                if( !(baudRate = baudRateMatchString( argv[++t] )) || !baudRate->rate )
     152                    log( -2, "Unknown Baud Rate \"%s\"", argv[t] );
    155153                break;
    156154            default:
    157                 fprintf( stderr, "Unknown Option: %s\n\n", argv[t] );
    158                 usage();
     155                log( -2, "Unknown Option: \"%s\"", argv[t] );
    159156            }
    160157        }
     
    179176
    180177    if( !baudRate )
    181         baudRate = baudRateMatchString( "38400" );
     178        baudRate = baudRateMatchString( "9600" );
    182179
    183180    do
     
    206203        vfprintf( stderr, message, args );
    207204        fprintf( stderr, "\n" );
     205        if( level < -1 )
     206        {
     207            fprintf( stderr, "\n" );
     208            usage();
     209        }
    208210        exit( 1 );
    209211    }
  • trunk/Serial_Server/win32/Win32Serial.h

    r225 r233  
    3737        if( !strcmp( name, "PIPE" ) )
    3838        {
    39             log( 0, "Opening named pipe %s (simulating %lu baud)", PIPENAME, baudRate->rate );
     39            log( 0, "Opening named pipe %s (simulating %s baud)", PIPENAME, baudRate->display );
    4040       
    4141            pipe = CreateNamedPipeA( PIPENAME, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE|PIPE_REJECT_REMOTE_CLIENTS, 2, 1024, 1024, 0, NULL );
  • trunk/XTIDE_Universal_BIOS/Inc/ATA_ID.inc

    r3 r233  
    254254    .wRMSN      resw 1  ; 127F, Removable Media Status Notification feature set support
    255255    .wSecurity  resw 1  ; 128FV, Security Status
    256                 resw 160-129    ; 129...159X
     256                resw 159-129    ; 129...158X, Vendor Specific
     257    .wVendor    resw 1  ; 159X, Vendor Specific - picking one word for use by the Serial Port code
    257258    .wCFAPower  resw 1  ; 160FV, CFA Power Mode 1
    258259                resw 176-161    ; 161...175R, Reserved for assignment by the CompactFlash Association
  • trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc

    r232 r233  
    2828    .dpt                        resb    DPT_size
    2929
    30     ; Block size is specified in sectors (1, 2, 4, 8, 16, 32, 64 or 128)
     30    ; Block size is specified in sectors (1, 2, 4, 8, 16, 32 or 64).
     31    ; 128 is not allowed to prevent offset overflow during data transfer.
    3132    .wSetAndMaxBlock:
    3233    .bSetBlock                  resb    1   ; Current block size (at least 1)
     
    3940    .dpt                        resb    DPT_size
    4041
    41     .bSerialPortAndBaud         resb    1   ; Packed I/O port and baud rate for serial drives
    42                                 resb    1   ; unused alignment
     42    .wSerialPortAndBaud:
     43    .bSerialPort                resb    1   ; Serial connection I/O port address, divided by 4
     44    .bSerialBaud                resb    1   ; Serial connection baud rate divisor
    4345endstruc
    4446%endif
  • trunk/XTIDE_Universal_BIOS/Inc/RamVars.inc

    r218 r233  
    1313    .bHDSwap        resb    1   ; Hard Drive to swap to 80h and vice versa
    1414    .bXlatedDrv     resb    1   ; Drive number after translation
    15 %ifdef MODULE_SERIAL
    16     .bLastSerial    resb    1   ; Packed Port and Baud for last serial drive detected
    17                                 ; (using space of an alignment byte,
    18                                 ; used during and after boot (int13/25h case))
    19 %else
    2015                    resb    1   ; alignment
    21 %endif
    2216endstruc
    2317
  • trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc

    r227 r233  
    4848; Controller specific variables
    4949struc IDEVARS
     50;;; Word 0
     51    .wSerialPortAndBaud:                    ; Serial connection port (low, divided by 4) and baud rate divisor (high)
    5052    .wPort:                                 ; IDE Base Port for Command Block (usual) Registers
    51     .bSerialCOMDigit            resb    1   ; Serial Device COM Port digit
    52     .bSerialPackedPortAndBaud   resb    1   ; Serial Device packed port and baud
     53    .bSerialPort                resb    1
     54    .bSerialBaud                resb    1
    5355
    54     .wPortCtrl:                             ; IDE Base Port for Control Block Registers
    55     .wSerialPackedPrintBaud     resb    2   ; Serial Device packed baud rate for printing
     56;;; Word 1
     57    .wPortCtrl:
     58    .bSerialUnused              resb    1   ; IDE Base Port for Control Block Registers
    5659
     60    .wSerialCOMPortCharAndDevice:           ; In DetectPrint, we grab the COM Port char and Device at the same time
     61    .bSerialCOMPortChar         resb    1   ; Serial connection COM port number/letter
     62
     63;;; Word 2
    5764    .bDevice                    resb    1   ; Device type
     65
    5866    .bIRQ                       resb    1   ; Interrupt Request Number
     67
     68;;; And more...
    5969    .drvParamsMaster            resb    DRVPARAMS_size
    6070    .drvParamsSlave             resb    DRVPARAMS_size
    6171endstruc
     72
     73%if IDEVARS.bSerialCOMPortChar+1 != IDEVARS.bDevice
     74%erorr "IDEVARS.bSerialCOMPortChar needs to come immediately before IDEVARS.bDevice so that both bytes can be fetched at the same time inside DetectPrint.asm"
     75%endif
    6276
    6377; Default values for Port and PortCtrl, shared with the configurator
     
    6781DEVICE_ATA_DEFAULT_PORT                 EQU     1F0h
    6882DEVICE_ATA_DEFAULT_PORTCTRL             EQU     3F0h
    69 DEVICE_SERIAL_DEFAULT_COM               EQU     0       ; COM1
    70 DEVICE_SERIAL_DEFAULT_BAUD              EQU     1       ; 9600
    7183
    7284; Device types for IDEVARS.bDevice
     
    7789DEVICE_16BIT_ATA                        EQU (3<<1)
    7890DEVICE_32BIT_ATA                        EQU (4<<1)
    79 DEVICE_SERIAL_PORT                      EQU (5<<1)
     91DEVICE_SERIAL_PORT                      EQU (5<<1)      ; must be last entry, or remove optimization in DetectPrint
    8092
    8193
     
    94106FLG_DRVPARAMS_BLOCKMODE EQU (1<<1)  ; Enable Block mode transfers
    95107FLG_DRVPARAMS_USERLBA   EQU (1<<2)  ; User specified LBA values
    96 
    97 
    98 ; Defines for IDEVARS.bSerialPackedPortAndBaud (same format used by DPT.bSerialPortAndBaud)
    99 ;
    100 ; pppp ppbb
    101 ;   i/o port address = p * 2 + 240h
    102 ;   baud rate = b, where 00 = 2400, 01 = 9600, 10 = 38.4K, 11 = 115.2K
    103 ;
    104 ; 240h/2400baud corresponds to 0 for a PackedPortAndBaud value, which triggers auto detect code.
    105 ; Which means 240h is not usable, and is why ..._MINPORT is 248h.  A value is reserved at the upper
    106 ; end of the spectrum in case it is needed (whcih is why it is 430h instead of 438h).
    107 ;
    108 DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTMASK            EQU     0fch
    109 DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTBITS            EQU     03fh
    110 DEVICE_SERIAL_PACKEDPORTANDBAUD_PORT_FIELD_POSITION EQU     2
    111 DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT        EQU     240h
    112 DEVICE_SERIAL_PACKEDPORTANDBAUD_MINPORT             EQU     248h    ; minimum port value that the user can set
    113 DEVICE_SERIAL_PACKEDPORTANDBAUD_MAXPORT             EQU     430h    ; or ((..._PORTMASK-1) << 1) + ..._STARTINGPORT
    114 
    115 DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDMASK            EQU     3h
    116 DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDBITS            EQU     3h
    117 DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUD_FIELD_POSITION EQU     0
    118 
    119 ; Defines for IDEVARS.wSerialPrintBaud
    120 ;
    121 ; pppp ppnn nnnn nnnn
    122 ;   unsigned number to output = n
    123 ;   postfix character = p + '0' (designed for '0' and 'K', although other values are possible)
    124 ;
    125 ; Note that the contents of this word is only used for printing by the BIOS when a drive is detected. 
    126 ; It is not used for any other purpose, and so long as it conforms to the structure, any values can be used.
    127 ;
    128 DEVICE_SERIAL_PRINTBAUD_NUMBERMASK      EQU     003ffh
    129 DEVICE_SERIAL_PRINTBAUD_POSTCHARMASK    EQU     0fc00h
    130 DEVICE_SERIAL_PRINTBAUD_POSTCHARADD     EQU     '0'
    131 ;
    132 ; These are defined here (instead of in the configurator) for consistency since they could also be used
    133 ; in main.asm as a default for an IDEVARS structure.
    134 ;
    135 DEVICE_SERIAL_PRINTBAUD_2400  EQU ((('0'-DEVICE_SERIAL_PRINTBAUD_POSTCHARADD)<<10) | 240)       ; Prints "2400"
    136 DEVICE_SERIAL_PRINTBAUD_9600  EQU ((('0'-DEVICE_SERIAL_PRINTBAUD_POSTCHARADD)<<10) | 960)       ; Prints "9600"
    137 DEVICE_SERIAL_PRINTBAUD_38_4  EQU ((('K'-DEVICE_SERIAL_PRINTBAUD_POSTCHARADD)<<10) | 38)        ; Prints "38K"
    138 DEVICE_SERIAL_PRINTBAUD_115_2 EQU ((('K'-DEVICE_SERIAL_PRINTBAUD_POSTCHARADD)<<10) | 115)       ; Prints "115K"
    139108
    140109;
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIrq.asm

    r161 r233  
    109109    ; Reading Status Register acknowledges IDE interrupt
    110110    call    RamVars_GetSegmentToDS
    111     call    FindDPT_ToDSDIforInterruptInService
     111    mov     bl, FLGH_DPT_INTERRUPT_IN_SERVICE
     112    call    FindDPT_ToDSDIforFlagsHighInBL
    112113    mov     dl, STATUS_REGISTER_in
    113114    call    IdeIO_InputToALfromIdeRegisterInDL
  • trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm

    r226 r233  
    1717;
    1818; Values for UART_divisorLow:
    19 ; 60h = 1200, 30h = 2400, 18h = 4800, 0ch = 9600, 6 = 19200, 3 = 38400, 2 = 57600, 1 = 115200
     19; 60h = 1200, 30h = 2400, 18h = 4800, 0ch = 9600, 6 = 19200, 4 = 28800, 3 = 38400, 2 = 57600, 1 = 115200
    2020;
    2121SerialCommand_UART_divisorLow                   EQU     0
    22 
    23 ;
    24 ; We support 4 baud rates, starting here going higher and skipping every other baud rate
    25 ; Starting with 30h, that means 30h (1200 baud), 0ch (9600 baud), 3 (38400 baud), and 1 (115200 baud)
    26 ; Note: hardware baud multipliers (2x, 4x) will impact the final baud rate and are not known at this level
    27 ;
    28 SerialCommand_UART_divisorLow_startingBaud      EQU   030h
    29 
    30 SerialCommand_UART_interruptEnable              EQU     1
    3122
    3223;
     
    9182        mov     [bp+IDEPACK.bFeatures],ah       ; store protocol command
    9283
    93         mov     dl, byte [di+DPT_SERIAL.bSerialPortAndBaud]
     84        mov     dx, [di+DPT_SERIAL.wSerialPortAndBaud]
    9485
    9586; fall-through
    9687
    9788;--------------------------------------------------------------------
    98 ; SerialCommand_OutputWithParameters_DeviceInDL
     89; SerialCommand_OutputWithParameters_DeviceInDX
    9990;   Parameters:
    10091;       AH:     Protocol Command
    101 ;       DL:     Packed I/O port and baud rate
     92;       DX:     Packed I/O port and baud rate
    10293;       ES:SI:  Ptr to buffer (for data transfer commands)
    10394;       SS:BP:  Ptr to IDEREGS_AND_INTPACK
     
    10899;       AL, BX, CX, DX, (ES:SI for data transfer commands)
    109100;--------------------------------------------------------------------
    110 SerialCommand_OutputWithParameters_DeviceInDL:
     101SerialCommand_OutputWithParameters_DeviceInDX:
    111102
    112103        push    si
     
    116107;
    117108; Unpack I/O port and baud from DPT
    118 ;       Port to DX more or less for the remainder of the routine
     109;       Port to DX for the remainder of the routine (+/- different register offsets)
    119110;       Baud in CH until UART initialization is complete
    120111;
    121         mov     dh, ((DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT & 0f00h) >> (8+1))
    122         shl     dx, 1       ; port offset already x4, needs one more shift to be x8
    123         mov     cl, dl
    124 
    125         and     cl, (DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDMASK << 1)
    126         mov     ch, SerialCommand_UART_divisorLow_startingBaud
    127         shr     ch, cl
    128         adc     ch, 0
    129 
    130         and     dl, ((DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTMASK << 1) & 0ffh)
    131         add     dx, byte (DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT & 0ffh)
    132 
     112        mov     ch,dh
     113        xor     dh,dh
     114        eSHL_IM dx, 2           ; shift from one byte to two       
     115       
    133116        mov     al,[bp+IDEPACK.bSectorCount]
    134117
     
    414397; taken care of this, but I have seen cases where this is not true.
    415398;
     399        xor     cx,cx                   ; timeout this clearing routine, in case the UART isn't there
    416400.clearBuffer:
    417401        mov     dl,bh
     
    420404        test    al,08fh
    421405        jz      .clearBufferComplete
    422         shr     al,1
     406        test    al,1
    423407        in      al,dx
    424         jc      .clearBuffer    ; note CF from shr above
     408        loopnz  .clearBuffer            ; note ZF from test above
    425409
    426410.clearBufferComplete:
     
    641625;     master scan.
    642626;
    643         mov     dl,[cs:bp+IDEVARS.bSerialPackedPortAndBaud]
    644         mov     al, byte [RAMVARS.xlateVars+XLATEVARS.bLastSerial]
     627        mov     cx,1            ; 1 sector to move, 0 for non-scan
     628        mov     dx,[cs:bp+IDEVARS.wSerialPortAndBaud]
     629        xor     ax,ax
     630        push    si
     631        call    FindDPT_ToDSDIforSerialDevice
     632        pop     si
     633        jnc     .notfounddpt
     634        mov     ax,[ds:di+DPT_SERIAL.wSerialPortAndBaud]
     635.notfounddpt:   
    645636
    646637        test    bh, FLG_DRVNHEAD_DRV
    647638        jz      .master
    648639
    649         test    al,al           ; Take care of the case that is different between master and slave.
     640        test    ax,ax           ; Take care of the case that is different between master and slave.
    650641        jz      .error          ; Because we do this here, the jz after the "or" below will not be taken
    651642
    652643; fall-through
    653644.master:
    654         test    dl,dl
    655         jnz     .identifyDeviceInDL
    656 
    657         or      dl,al           ; Move bLast into position in dl, as well as test for zero
     645        test    dx,dx
     646        jnz     .identifyDeviceInDX
     647
     648        or      dx,ax           ; Move bLast into position in dl, as well as test for zero
    658649        jz      .scanSerial
    659650
    660651; fall-through
    661 .identifyDeviceInDL:
     652.identifyDeviceInDX:
    662653
    663654        push    bp              ; setup fake IDEREGS_AND_INTPACK
     
    665656        push    dx
    666657
    667         mov     cl,1            ; 1 sector to move
    668658        push    cx
    669659
     
    674664
    675665        mov     bp,sp
    676         call    SerialCommand_OutputWithParameters_DeviceInDL
     666        call    SerialCommand_OutputWithParameters_DeviceInDX
    677667
    678668        pop     bx
     
    680670        pop     cx
    681671        pop     dx
    682 
     672       
    683673        pop     bp
    684674;
    685675; place packed port/baud in RAMVARS, read by FinalizeDPT and DetectDrives
    686676;
    687 ; Note that this will be set during an int13h/25h call as well.  Which is OK since it is only used (at the
    688 ; top of this routine) for drives found during a COM scan, and we only COM scan if there were no other
    689 ; COM drives found.  So we will only reaffirm the port/baud for the one COM port/baud that has a drive.
    690 ;
    691         jc      .notFound                                           ; only store bLastSerial if success
    692         mov     byte [RAMVARS.xlateVars+XLATEVARS.bLastSerial], dl
     677        mov     [es:si+ATA6.wVendor],dx
    693678
    694679.notFound:
     
    714699.scanSerial:
    715700        mov     di,.scanPortAddresses-1
     701        mov     ch,1            ;  tell server that we are scanning
    716702
    717703.nextPort:
     
    741727
    742728;
    743 ; Pack into dl, baud rate starts at 0
    744 ;
    745         add     dx,-(DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT)
    746         shr     dx,1            ; dh is zero at this point, and will be sent to the server,
    747                                 ; so we know this is an auto detect
    748 
    749         jmp     .testFirstBaud
    750 
    751 ;
    752 ; Walk through 4 possible baud rates
    753 ;
     729; Begin baud rate scan on this port...
     730;
     731; On a scan, we support 6 baud rates, starting here and going higher by a factor of two each step, with a
     732; small jump between 9600 and 38800.  These 6 were selected since we wanted to support 9600 baud and 115200,
     733; *on the server side* if the client side had a 4x clock multiplier, a 2x clock multiplier, or no clock multiplier.
     734;
     735; Starting with 30h, that means 30h (2400 baud), 18h (4800 baud), 0ch (9600 baud), and
     736;                               04h (28800 baud), 02h (57600 baud), 01h (115200 baud)
     737;
     738; Note: hardware baud multipliers (2x, 4x) will impact the final baud rate and are not known at this level
     739;
     740        mov     dh,030h * 2     ; multiply by 2 since we are about to divide by 2
     741        mov     dl,[cs:di]      ; restore single byte port address for scan
     742
    754743.nextBaud:
    755         inc     dx
    756         test    dl,3
     744        shr     dh,1
    757745        jz      .nextPort
    758 
    759 .testFirstBaud:
    760         call    .identifyDeviceInDL
     746        cmp     dh,6            ; skip from 6 to 4, to move from the top of the 9600 baud range
     747        jnz     .testBaud       ; to the bottom of the 115200 baud range
     748        mov     dh,4
     749
     750.testBaud:
     751        call    .identifyDeviceInDX
    761752        jc      .nextBaud
    762753
  • trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialDPT.asm

    r226 r233  
    1717SerialDPT_Finalize:
    1818        or      byte [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
    19         mov     al, [RAMVARS.xlateVars+XLATEVARS.bLastSerial]
    20         mov     byte [di+DPT_SERIAL.bSerialPortAndBaud], al
     19        mov     ax, [es:si+ATA6.wVendor]
     20        mov     word [di+DPT_SERIAL.wSerialPortAndBaud], ax
    2121        ret
    2222
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm

    r203 r233  
    2222
    2323.DriveDetectLoop:                           ; Loop through IDEVARS
    24     mov     si, g_szDetect                  ; Setup standard print string
     24    push    cx
     25
     26    mov     cx, g_szDetectMaster
     27    mov     bh, MASK_DRVNHEAD_SET                               ; Select Master drive
     28    call    StartDetectionWithDriveSelectByteInBHandStringInAX  ; Detect and create DPT + BOOTNFO
     29
     30    mov     cx, g_szDetectSlave
     31    mov     bh, MASK_DRVNHEAD_SET | FLG_DRVNHEAD_DRV 
     32    call    StartDetectionWithDriveSelectByteInBHandStringInAX
     33       
     34    pop     cx
     35
     36    add     bp, BYTE IDEVARS_size           ; Point to next IDEVARS
     37
    2538%ifdef MODULE_SERIAL       
    26     cmp     byte [cs:bp+IDEVARS.bDevice], DEVICE_SERIAL_PORT
    27     jnz     .DriveNotSerial                 ; Special print string for serial drives
    28     mov     si, g_szDetectCOM
    29 .DriveNotSerial:
     39    jcxz    .done                           ; Set to zero on .ideVarsSerialAuto iteration (if any)
    3040%endif
    31 
    32     call    .DetectDrives_WithIDEVARS       ; Detect Master and Slave
    33     add     bp, BYTE IDEVARS_size           ; Point to next IDEVARS
     41       
    3442    loop    .DriveDetectLoop
    3543
    3644%ifdef MODULE_SERIAL       
    3745;
    38 ; if serial drive detected, do not scan (avoids duplicate drives and isn't needed - we have a connection)
    39 ; Note that XLATEVARS.bLastSerial is zero'd in RamVars_Initialize, called in Initialize_AutoDetectDrives;
    40 ; bLastSerial it set in the detection code of SerialCommand.asm
     46; if serial drive detected, do not scan (avoids duplicate drives and isn't needed - we already have a connection)
    4147;
    42     cmp     byte [RAMVARS.xlateVars+XLATEVARS.bLastSerial],cl   ; cx = zero after the loop above
    43                                                                 ; less instruction bytes than using immediate
    44     jnz     .done                                                 
    45        
     48    call    FindDPT_ToDSDIforSerialDevice
     49    jc      .done
     50
     51    mov     bp, ROMVARS.ideVarsSerialAuto   ; Point to our special IDEVARS sructure, just for serial scans     
     52               
    4653    mov     al,[cs:ROMVARS.wFlags]          ; Configurator set to always scan?
    4754    or      al,[es:BDA.bKBFlgs1]            ; Or, did the user hold down the ALT key?
    4855    and     al,8                            ; 8 = alt key depressed, same as FLG_ROMVARS_SERIAL_ALWAYSDETECT
    49     jz      .done                           
     56    jnz     .DriveDetectLoop                           
     57%endif
    5058
    51     mov     bp, ROMVARS.ideVarsSerialAuto   ; Point to our special IDEVARS sructure, just for serial scans
    52     mov     si, g_szDetectCOMAuto           ; Special, special print string for serial drives during a scan
    53 ;;; fall-through                   
    54 %else
     59.done:
    5560    ret
    56 %endif
    5761
    5862%if FLG_ROMVARS_SERIAL_SCANDETECT != 8
     
    6064%endif
    6165
    62 ;--------------------------------------------------------------------
    63 ; Detects IDE hard disks by using information from IDEVARS.
    64 ;
    65 ; DetectDrives_WithIDEVARS
    66 ;   Parameters:
    67 ;       CS:BP:      Ptr to IDEVARS
    68 ;       DS:         RAMVARS segment
    69 ;       ES:         Zero (BDA segment)
    70 ;       SI:         Ptr to template string
    71 ;   Returns:
    72 ;       Nothing
    73 ;   Corrupts registers:
    74 ;       AX, BX, DX, SI, DI
    75 ;--------------------------------------------------------------------
    76 .DetectDrives_WithIDEVARS:
    77     push    cx
    78 
    79     push    si     
    80     mov     ax, g_szMaster
    81     mov     bh, MASK_DRVNHEAD_SET                               ; Select Master drive
    82     call    StartDetectionWithDriveSelectByteInBHandStringInAX  ; Detect and create DPT + BOOTNFO
    83     pop     si
    84 
    85     mov     ax, g_szSlave
    86     mov     bh, MASK_DRVNHEAD_SET | FLG_DRVNHEAD_DRV
    87     call    StartDetectionWithDriveSelectByteInBHandStringInAX
    88     pop     cx
    89        
    90 .done: 
    91     ret
    92 
    9366       
    9467;--------------------------------------------------------------------
    9568; StartDetectionWithDriveSelectByteInBHandStringInAX
    9669;   Parameters:
    97 ;       AX:     Offset to "Master" or "Slave" string
    9870;       BH:     Drive Select byte for Drive and Head Register
     71;       CX:     Offset to "Master" or "Slave" string
    9972;       CS:BP:  Ptr to IDEVARS for the drive
    10073;       DS:     RAMVARS segment
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm

    r203 r233  
    3030; DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP
    3131;   Parameters:
    32 ;       CS:AX:  Ptr to "Master" or "Slave" string
     32;       CS:CX:  Ptr to "Master" or "Slave" string
    3333;       CS:BP:  Ptr to IDEVARS
    3434;       SI:     Ptr to template string
     
    3939;--------------------------------------------------------------------
    4040DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP:
    41     push    bp
    42     mov     di, [cs:bp+IDEVARS.wPort]
    43 %ifdef MODULE_SERIAL
    44     mov     cx, [cs:bp+IDEVARS.wSerialPackedPrintBaud]
    45 %endif
     41
     42    mov     ax, [cs:bp+IDEVARS.wPort]       ; for IDE: AX=port address, DH=.bDevice
     43    mov     dx, [cs:bp+IDEVARS.bDevice-1]   ; for Serial: AL=port address>>2, AH=baud rate
     44                                            ;             DL=COM number character, DH=.bDevice
     45
     46    push    bp                              ; setup stack for call to
     47    mov     bp, sp                          ; BootMenuPrint_FormatCSSIfromParamsInSSBP
     48
     49    push    cx                              ; Push "Master" or "Slave"
    4650       
    47     mov     bp, sp
     51    mov     cl, (g_szDetectPort-$$) & 0xff  ; Setup print string for standard IDE
     52                                            ; Note that we modify only the low order bits of CX a lot here,
     53                                            ; saving code space rather than reloading CX completely.
     54                                            ; This optimization requires that all the g_szDetect* strings are
     55                                            ; on the same 256 byte page, which is checked in strings.asm.
    4856
    49     push    ax                          ; Push "Master" or "Slave"
     57    cmp     dx, DEVICE_SERIAL_PORT << 8     ; Check if this is a serial device,
     58                                            ; And also check if DL is zero, check with the jz below
     59                                            ; This optimization requires that DEVICE_SERIAL_PORT be
     60                                            ; the highest value in the DEVICE_* series, ensuring that
     61                                            ; anything less in the high order bits is a different device.
     62
     63    jl      .pushAndPrint                   ; CX = string to print, AX = port address, DX won't be used
     64
     65    mov     cl, (g_szDetectCOM-$$) & 0xff   ; Setup print string for COM ports
     66    push    cx                              ; And push now.  We use the fact that format strings can contain
     67                                            ; themselves format strings.
     68
     69    push    dx                              ; Push COM number character
     70               
     71    mov     cl, (g_szDetectCOMAuto-$$) & 0xff   ; Setup secondary print string for "Auto"
    5072       
    51     push    di                          ; Push Port address or COM port number
     73    jz      .pushAndPrint                   ; CX = string to print, AX and DX won't be used
     74       
     75    mov     cl, (g_szDetectCOMLarge-$$) & 0xff  ; Setup secondary print string for "COMn/xx.yK"
    5276
    53 %ifdef MODULE_SERIAL
    54 ;
    55 ; Print baud rate from .wSerialPackedPrintBaud, in two parts - %u and then %c
    56 ;
    57     mov     ax,cx                       ; Unpack baud rate number
    58     and     ax,DEVICE_SERIAL_PRINTBAUD_NUMBERMASK
    59     push    ax
     77    mov     al,ah                           ; baud rate divisor to AL
     78    cbw                                     ; clear AH, AL will always be less than 128
     79    xchg    si,ax                           ; move AX to SI for divide
     80    mov     ax,1152                         ; baud rate to displa is 115200/divisor, the "00" is handled
     81                                            ; in the print strings
     82    xor     dx,dx                           ; clear top 16-bits of dividend
     83    div     si                              ; and divide...  Now AX = baud rate/100, DX = 0 (always a clean divide)
     84       
     85    mov     si,10                           ; Now separate the whole portion from the fractional for "K" display
     86    div     si                              ; and divide...  Now AX = baud rate/1000, DX = low order digit
     87       
     88    cmp     ax,si                           ; <= 10: "2400", "9600", etc.; >10: "19.2K", "38.4K", etc.
     89    jae     .pushAndPrint
    6090
    61     mov     al,ch                       ; Unpack baud rate postfix ('0' or 'K')
    62     eSHR_IM al,2                        ; also effectively masks off the postfix
    63     add     al,DEVICE_SERIAL_PRINTBAUD_POSTCHARADD
    64     push    ax
    65 %endif
    66                        
     91    mov     cl, (g_szDetectCOMSmall-$$) & 0xff  ; Setup secondary print string for "COMn/XXy00"
     92       
     93.pushAndPrint: 
     94    push    cx                              ; Push print string
     95    push    ax                              ; Push high order digits, or port address, or N/A
     96    push    dx                              ; Push low order digit, or N/A
     97
     98    mov     si, g_szDetectOuter             ; Finally load SI with wrapper string "IDE %s at %s: "
     99
    67100    jmp     short DetectPrint_BootMenuPrint_FormatCSSIfromParamsInSSBP_Relay   
    68101
     
    92125
    93126
     127
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r229 r233  
    112112%ifdef MODULE_SERIAL
    113113    at  ROMVARS.ideVarsSerialAuto+IDEVARS.bDevice,      db  DEVICE_SERIAL_PORT
    114     at  ROMVARS.ideVarsSerialAuto+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db  FLG_DRVPARAMS_BLOCKMODE
    115     at  ROMVARS.ideVarsSerialAuto+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,  db  FLG_DRVPARAMS_BLOCKMODE
    116114%endif
    117115%else
     
    145143%ifdef MODULE_SERIAL
    146144    at  ROMVARS.ideVarsSerialAuto+IDEVARS.bDevice,      db  DEVICE_SERIAL_PORT
    147     at  ROMVARS.ideVarsSerialAuto+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db  FLG_DRVPARAMS_BLOCKMODE
    148     at  ROMVARS.ideVarsSerialAuto+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,  db  FLG_DRVPARAMS_BLOCKMODE
    149145%endif
    150146%endif
  • trunk/XTIDE_Universal_BIOS/Src/Strings.asm

    r197 r233  
    1212g_szRomAt:      db  "%s @ %x",LF,CR,NULL
    1313
    14 g_szMaster:             db  "IDE Master at ",NULL
    15 g_szSlave:              db  "IDE Slave  at ",NULL
    16 g_szDetect:             db  "%s%x: ",NULL                      ; IDE Master at 1F0h:
    17 g_szDetectCOM:          db  "%sCOM%c/%u%c: ",NULL              ; IDE Master at COM1/115K:       
    18 g_szDetectCOMAuto:      db  "%sCOM Detect: ",NULL              ; IDE Master at COM Detect:
     14; The following strings are used by DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP
     15; To support an optimization in that code, these strings must start on the same 256 byte page,
     16; which is checked at assembly time below.
     17;
     18g_szDetectStart:       
     19g_szDetectMaster:       db  "Master",NULL
     20g_szDetectSlave:        db  "Slave ",NULL
     21g_szDetectOuter:        db  "IDE %s at %s: ",NULL
     22g_szDetectPort:         db  "%x",NULL                       ; IDE Master at 1F0h:
     23g_szDetectCOM:          db  "COM%c%s",NULL           
     24g_szDetectCOMAuto:      db  " Auto",NULL
     25g_szDetectCOMSmall:     db  "/%u%u00",NULL                  ; IDE Master at COM1/9600:
     26g_szDetectEnd:
     27g_szDetectCOMLarge:     db  "/%u.%uK",NULL                  ; IDE Master at COM1/19.2K:
     28       
     29%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS               
     30%if ((g_szDetectEnd-$$) & 0xff00) <> ((g_szDetectStart-$$) & 0xff00)
     31%error "g_szDetect* strings must be on the same 256 byte page, required by DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP.  Please move this block up or down within strings.asm"
     32%endif
     33%endif             
    1934               
    2035; Boot loader strings
     
    137152;$translate{200}      = 18;    # DOUBLE_BOTTOM_LEFT_CORNER
    138153;$translate{181}      = 19;    # DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL
     154;$translate{ord('0')} = 20;    # DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL     
    139155;
    140156; Formats begin immediately after the last Translated character (they are in the same table)
    141157;
    142 ;$format_begin = 20;
     158;$format_begin = 21;
    143159;
    144 ;$format{"s"}   = 20;        # n/a
    145160;$format{"c"}   = 21;        # n/a
    146161;$format{"2-I"} = 22;        # must be even
     
    152167;$format{"2-u"} = 28;        # must be even
    153168;$format{"A"}   = 29;        # n/a
     169;$format{"s"}   = 30;        # n/a     
    154170;
    155171; NOTE: The last $format cannot exceed 31 (stored in a 5-bit quantity).
  • trunk/XTIDE_Universal_BIOS/Src/StringsCompressed.asm

    r197 r233  
    2020g_szRomAt:      ; db    "%s @ %x",LF,CR,NULL
    2121                ; db     25h,  73h,  20h,  40h,  20h,  25h,  78h,  0ah,  0dh,  00h    ; uncompressed
    22                   db     34h,  20h, 0c6h,  39h,  1bh                                  ; compressed
    23 
    24 
    25 g_szMaster:             ; db    "IDE Master at ",NULL
    26                         ; db     49h,  44h,  45h,  20h,  4dh,  61h,  73h,  74h,  65h,  72h,  20h,  61h,  74h,  20h,  00h    ; uncompressed
    27                           db     4fh,  4ah, 0cbh,  53h,  67h,  79h,  7ah,  6bh, 0f8h,  67h,  7ah,  00h                      ; compressed
    28 
    29 g_szSlave:              ; db    "IDE Slave  at ",NULL
    30                         ; db     49h,  44h,  45h,  20h,  53h,  6ch,  61h,  76h,  65h,  20h,  20h,  61h,  74h,  20h,  00h    ; uncompressed
    31                           db     4fh,  4ah, 0cbh,  59h,  72h,  67h,  7ch, 0ebh,  20h,  67h,  7ah,  00h                      ; compressed
    32 
    33 g_szDetect:             ; db    "%s%x: ",NULL                      ; IDE Master at 1F0h:
    34                         ; db     25h,  73h,  25h,  78h,  3ah,  20h,  00h    ; uncompressed
    35                           db     34h,  39h,  40h,  00h                      ; compressed
    36 
    37 g_szDetectCOM:          ; db  "%sCOM%c/%u%c: ",NULL              ; IDE Master at COM1/115K:     
    38                         ; db   25h,  73h,  43h,  4fh,  4dh,  25h,  63h,  2fh,  25h,  75h,  25h,  63h,  3ah,  20h,  00h    ; uncompressed
    39                           db   34h,  49h,  55h,  53h,  35h,  2ah,  37h,  35h,  40h,  00h                                  ; compressed
    40 
    41 g_szDetectCOMAuto:      ; db  "%sCOM Detect: ",NULL            ; IDE Master at COM Detect:
    42                         ; db   25h,  73h,  43h,  4fh,  4dh,  20h,  44h,  65h,  74h,  65h,  63h,  74h,  3ah,  20h,  00h    ; uncompressed
    43                           db   34h,  49h,  55h, 0d3h,  4ah,  6bh,  7ah,  6bh,  69h,  7ah,  40h,  00h                      ; compressed
    44 
     22                  db     3eh,  20h, 0c6h,  39h,  1bh                                  ; compressed
     23
     24
     25; The following strings are used by DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP
     26; To support an optimization in that code, these strings must start on the same 256 byte page,
     27; which is checked at assembly time below.
     28;
     29g_szDetectStart:       
     30g_szDetectMaster:       ; db    "Master",NULL
     31                        ; db     4dh,  61h,  73h,  74h,  65h,  72h,  00h    ; uncompressed
     32                          db     53h,  67h,  79h,  7ah,  6bh, 0b8h          ; compressed
     33
     34g_szDetectSlave:        ; db    "Slave ",NULL
     35                        ; db     53h,  6ch,  61h,  76h,  65h,  20h,  00h    ; uncompressed
     36                          db     59h,  72h,  67h,  7ch,  6bh,  00h          ; compressed
     37
     38g_szDetectOuter:        ; db    "IDE %s at %s: ",NULL
     39                        ; db     49h,  44h,  45h,  20h,  25h,  73h,  20h,  61h,  74h,  20h,  25h,  73h,  3ah,  20h,  00h    ; uncompressed
     40                          db     4fh,  4ah, 0cbh,  3eh,  20h,  67h, 0fah,  3eh,  40h,  00h                                  ; compressed
     41
     42g_szDetectPort:         ; db    "%x",NULL                       ; IDE Master at 1F0h:
     43                        ; db     25h,  78h,  00h    ; uncompressed
     44                          db     19h                ; compressed
     45
     46g_szDetectCOM:          ; db  "COM%c%s",NULL           
     47                        ; db   43h,  4fh,  4dh,  25h,  63h,  25h,  73h,  00h    ; uncompressed
     48                          db   49h,  55h,  53h,  35h,  1eh                      ; compressed
     49
     50g_szDetectCOMAuto:      ; db    " Auto",NULL
     51                        ; db     20h,  41h,  75h,  74h,  6fh,  00h    ; uncompressed
     52                          db     20h,  47h,  7bh,  7ah, 0b5h          ; compressed
     53
     54g_szDetectCOMSmall:     ; db    "/%u%u00",NULL                  ; IDE Master at COM1/9600:
     55                        ; db     2fh,  25h,  75h,  25h,  75h,  30h,  30h,  00h    ; uncompressed
     56                          db     2ah,  37h,  37h,  34h,  14h                      ; compressed
     57
     58g_szDetectEnd:
     59g_szDetectCOMLarge:     ; db    "/%u.%uK",NULL                  ; IDE Master at COM1/19.2K:
     60                        ; db     2fh,  25h,  75h,  2eh,  25h,  75h,  4bh,  00h    ; uncompressed
     61                          db     2ah,  37h,  29h,  37h,  91h                      ; compressed
     62
     63
     64%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS               
     65%if ((g_szDetectEnd-$$) & 0xff00) <> ((g_szDetectStart-$$) & 0xff00)
     66%error "g_szDetect* strings must be on the same 256 byte page, required by DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP.  Please move this block up or down within strings.asm"
     67%endif
     68%endif             
    4569
    4670; Boot loader strings
    4771g_szTryToBoot:          ; db    "Booting from %s %x",ANGLE_QUOTE_RIGHT,"%x",LF,CR,NULL
    4872                        ; db     42h,  6fh,  6fh,  74h,  69h,  6eh,  67h,  20h,  66h,  72h,  6fh,  6dh,  20h,  25h,  73h,  20h,  25h,  78h, 0afh,  25h,  78h,  0ah,  0dh,  00h    ; uncompressed
    49                           db     48h,  75h,  75h,  7ah,  6fh,  74h, 0edh,  6ch,  78h,  75h, 0f3h,  34h,  20h,  39h,  24h,  39h,  1bh                                              ; compressed
     73                          db     48h,  75h,  75h,  7ah,  6fh,  74h, 0edh,  6ch,  78h,  75h, 0f3h,  3eh,  20h,  39h,  24h,  39h,  1bh                                              ; compressed
    5074
    5175g_szBootSectorNotFound: ; db    "Boot sector "
     
    77101g_szHotkey:     ; db    "%A%c%c%A%s%A ",NULL
    78102                ; db     25h,  41h,  25h,  63h,  25h,  63h,  25h,  41h,  25h,  73h,  25h,  41h,  20h,  00h    ; uncompressed
    79                   db     3dh,  35h,  35h,  3dh,  34h,  3dh,  00h                                              ; compressed
     103                  db     3dh,  35h,  35h,  3dh,  3eh,  3dh,  00h                                              ; compressed
    80104
    81105
     
    88112g_szFDLetter:   ; db    "%s %c",NULL
    89113                ; db     25h,  73h,  20h,  25h,  63h,  00h    ; uncompressed
    90                   db     34h,  20h,  15h                      ; compressed
     114                  db     3eh,  20h,  15h                      ; compressed
    91115
    92116g_szFloppyDrv:  ; db    "Floppy Drive",NULL
     
    106130g_szSizeSingle: ; db    "%s%u.%u %ciB",NULL
    107131                ; db     25h,  73h,  25h,  75h,  2eh,  25h,  75h,  20h,  25h,  63h,  69h,  42h,  00h    ; uncompressed
    108                   db     34h,  37h,  29h,  37h,  20h,  35h,  6fh,  88h                                  ; compressed
     132                  db     3eh,  37h,  29h,  37h,  20h,  35h,  6fh,  88h                                  ; compressed
    109133
    110134g_szSizeDual:   ; db    "%s%5-u.%u %ciB /%5-u.%u %ciB",LF,CR,NULL
    111135                ; db     25h,  73h,  25h,  35h,  2dh,  75h,  2eh,  25h,  75h,  20h,  25h,  63h,  69h,  42h,  20h,  2fh,  25h,  35h,  2dh,  75h,  2eh,  25h,  75h,  20h,  25h,  63h,  69h,  42h,  0ah,  0dh,  00h    ; uncompressed
    112                   db     34h,  38h,  29h,  37h,  20h,  35h,  6fh, 0c8h,  2ah,  38h,  29h,  37h,  20h,  35h,  6fh,  48h,  1bh                                                                                        ; compressed
     136                  db     3eh,  38h,  29h,  37h,  20h,  35h,  6fh, 0c8h,  2ah,  38h,  29h,  37h,  20h,  35h,  6fh,  48h,  1bh                                                                                        ; compressed
    113137
    114138g_szCfgHeader:  ; db    "Addr.",SINGLE_VERTICAL,"Block",SINGLE_VERTICAL,"Bus",  SINGLE_VERTICAL,"IRQ",  SINGLE_VERTICAL,"Reset",LF,CR,NULL
     
    118142g_szCfgFormat:  ; db    "%s"   ,SINGLE_VERTICAL,"%5-u", SINGLE_VERTICAL,"%s",SINGLE_VERTICAL," %2-I",SINGLE_VERTICAL,"%5-x",  NULL
    119143                ; db     25h,  73h, 0b3h,  25h,  35h,  2dh,  75h, 0b3h,  25h,  73h, 0b3h,  20h,  25h,  32h,  2dh,  49h, 0b3h,  25h,  35h,  2dh,  78h,  00h    ; uncompressed
    120                   db     34h,  23h,  38h,  23h,  34h,  23h,  20h,  36h,  23h,  1ah                                                                            ; compressed
     144                  db     3eh,  23h,  38h,  23h,  3eh,  23h,  20h,  36h,  23h,  1ah                                                                            ; compressed
    121145
    122146
     
    159183g_szFddUnknown: ; db    "%sUnknown",NULL
    160184                ; db     25h,  73h,  55h,  6eh,  6bh,  6eh,  6fh,  77h,  6eh,  00h    ; uncompressed
    161                   db     34h,  5bh,  74h,  71h,  74h,  75h,  7dh, 0b4h                ; compressed
     185                  db     3eh,  5bh,  74h,  71h,  74h,  75h,  7dh, 0b4h                ; compressed
    162186
    163187g_szFddSizeOr:  ; db    "%s5",ONE_QUARTER,QUOTATION_MARK," or 3",ONE_HALF,QUOTATION_MARK," DD",NULL
    164188                ; db     25h,  73h,  35h, 0ach,  22h,  20h,  6fh,  72h,  20h,  33h, 0abh,  22h,  20h,  44h,  44h,  00h    ; uncompressed
    165                   db     34h,  2fh,  21h,  26h,  20h,  75h, 0f8h,  2dh,  22h,  26h,  20h,  4ah,  8ah                      ; compressed
     189                  db     3eh,  2fh,  21h,  26h,  20h,  75h, 0f8h,  2dh,  22h,  26h,  20h,  4ah,  8ah                      ; compressed
    166190
    167191g_szFddSize:    ; db    "%s%s",QUOTATION_MARK,", %u kiB",NULL   ; 3½", 1440 kiB
    168192                ; db     25h,  73h,  25h,  73h,  22h,  2ch,  20h,  25h,  75h,  20h,  6bh,  69h,  42h,  00h    ; uncompressed
    169                   db     34h,  34h,  26h,  27h,  20h,  37h,  20h,  71h,  6fh,  88h                            ; compressed
     193                  db     3eh,  3eh,  26h,  27h,  20h,  37h,  20h,  71h,  6fh,  88h                            ; compressed
    170194
    171195
     
    265289;$translate{200}      = 18;    # DOUBLE_BOTTOM_LEFT_CORNER    [StringsCompress Processed]
    266290;$translate{181}      = 19;    # DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL    [StringsCompress Processed]
     291;$translate{ord('0')} = 20;    # DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL          [StringsCompress Processed]
    267292;
    268293; Formats begin immediately after the last Translated character (they are in the same table)
    269294;
    270 ;$format_begin = 20;    [StringsCompress Processed]
    271 ;
    272 ;$format{"s"}   = 20;        # n/a    [StringsCompress Processed]
     295;$format_begin = 21;    [StringsCompress Processed]
     296;
    273297;$format{"c"}   = 21;        # n/a    [StringsCompress Processed]
    274298;$format{"2-I"} = 22;        # must be even    [StringsCompress Processed]
     
    280304;$format{"2-u"} = 28;        # must be even    [StringsCompress Processed]
    281305;$format{"A"}   = 29;        # n/a    [StringsCompress Processed]
     306;$format{"s"}   = 30;        # n/a          [StringsCompress Processed]
    282307;
    283308; NOTE: The last $format cannot exceed 31 (stored in a 5-bit quantity).
     
    299324StringsCompressed_NormalBase     equ   58
    300325
    301 StringsCompressed_FormatsBegin   equ   20
     326StringsCompressed_FormatsBegin   equ   21
    302327
    303328StringsCompressed_TranslatesAndFormats:
     
    322347        db     200  ; 18
    323348        db     181  ; 19
    324         db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_s)    ; 20
     349        db     48  ; 20
    325350        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_c)    ; 21
    326351        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_2_I)    ; 22
     
    332357        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_2_u)    ; 28
    333358        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_A)    ; 29
     359        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_s)    ; 30
    334360
    335361%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
     362%if DisplayFormatCompressed_BaseFormatOffset < DisplayFormatCompressed_Format_c || DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_c > 255
     363%error "DisplayFormatCompressed_Format_c is out of range of DisplayFormatCompressed_BaseFormatOffset"
     364%endif
     365%if DisplayFormatCompressed_BaseFormatOffset < DisplayFormatCompressed_Format_2_I || DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_2_I > 255
     366%error "DisplayFormatCompressed_Format_2_I is out of range of DisplayFormatCompressed_BaseFormatOffset"
     367%endif
     368%if DisplayFormatCompressed_BaseFormatOffset < DisplayFormatCompressed_Format_u || DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_u > 255
     369%error "DisplayFormatCompressed_Format_u is out of range of DisplayFormatCompressed_BaseFormatOffset"
     370%endif
     371%if DisplayFormatCompressed_BaseFormatOffset < DisplayFormatCompressed_Format_5_u || DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_5_u > 255
     372%error "DisplayFormatCompressed_Format_5_u is out of range of DisplayFormatCompressed_BaseFormatOffset"
     373%endif
     374%if DisplayFormatCompressed_BaseFormatOffset < DisplayFormatCompressed_Format_x || DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_x > 255
     375%error "DisplayFormatCompressed_Format_x is out of range of DisplayFormatCompressed_BaseFormatOffset"
     376%endif
     377%if DisplayFormatCompressed_BaseFormatOffset < DisplayFormatCompressed_Format_5_x || DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_5_x > 255
     378%error "DisplayFormatCompressed_Format_5_x is out of range of DisplayFormatCompressed_BaseFormatOffset"
     379%endif
     380%if DisplayFormatCompressed_BaseFormatOffset < DisplayFormatCompressed_Format_nl || DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_nl > 255
     381%error "DisplayFormatCompressed_Format_nl is out of range of DisplayFormatCompressed_BaseFormatOffset"
     382%endif
     383%if DisplayFormatCompressed_BaseFormatOffset < DisplayFormatCompressed_Format_2_u || DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_2_u > 255
     384%error "DisplayFormatCompressed_Format_2_u is out of range of DisplayFormatCompressed_BaseFormatOffset"
     385%endif
     386%if DisplayFormatCompressed_BaseFormatOffset < DisplayFormatCompressed_Format_A || DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_A > 255
     387%error "DisplayFormatCompressed_Format_A is out of range of DisplayFormatCompressed_BaseFormatOffset"
     388%endif
    336389%if DisplayFormatCompressed_BaseFormatOffset < DisplayFormatCompressed_Format_s || DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_s > 255
    337390%error "DisplayFormatCompressed_Format_s is out of range of DisplayFormatCompressed_BaseFormatOffset"
    338 %endif
    339 %if DisplayFormatCompressed_BaseFormatOffset < DisplayFormatCompressed_Format_c || DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_c > 255
    340 %error "DisplayFormatCompressed_Format_c is out of range of DisplayFormatCompressed_BaseFormatOffset"
    341 %endif
    342 %if DisplayFormatCompressed_BaseFormatOffset < DisplayFormatCompressed_Format_2_I || DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_2_I > 255
    343 %error "DisplayFormatCompressed_Format_2_I is out of range of DisplayFormatCompressed_BaseFormatOffset"
    344 %endif
    345 %if DisplayFormatCompressed_BaseFormatOffset < DisplayFormatCompressed_Format_u || DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_u > 255
    346 %error "DisplayFormatCompressed_Format_u is out of range of DisplayFormatCompressed_BaseFormatOffset"
    347 %endif
    348 %if DisplayFormatCompressed_BaseFormatOffset < DisplayFormatCompressed_Format_5_u || DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_5_u > 255
    349 %error "DisplayFormatCompressed_Format_5_u is out of range of DisplayFormatCompressed_BaseFormatOffset"
    350 %endif
    351 %if DisplayFormatCompressed_BaseFormatOffset < DisplayFormatCompressed_Format_x || DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_x > 255
    352 %error "DisplayFormatCompressed_Format_x is out of range of DisplayFormatCompressed_BaseFormatOffset"
    353 %endif
    354 %if DisplayFormatCompressed_BaseFormatOffset < DisplayFormatCompressed_Format_5_x || DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_5_x > 255
    355 %error "DisplayFormatCompressed_Format_5_x is out of range of DisplayFormatCompressed_BaseFormatOffset"
    356 %endif
    357 %if DisplayFormatCompressed_BaseFormatOffset < DisplayFormatCompressed_Format_nl || DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_nl > 255
    358 %error "DisplayFormatCompressed_Format_nl is out of range of DisplayFormatCompressed_BaseFormatOffset"
    359 %endif
    360 %if DisplayFormatCompressed_BaseFormatOffset < DisplayFormatCompressed_Format_2_u || DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_2_u > 255
    361 %error "DisplayFormatCompressed_Format_2_u is out of range of DisplayFormatCompressed_BaseFormatOffset"
    362 %endif
    363 %if DisplayFormatCompressed_BaseFormatOffset < DisplayFormatCompressed_Format_A || DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_A > 255
    364 %error "DisplayFormatCompressed_Format_A is out of range of DisplayFormatCompressed_BaseFormatOffset"
    365391%endif
    366392%endif
     
    374400;; 5-u:3
    375401;; x:6
     402;; s:15
    376403;; 5-x:1
    377 ;; s:15
    378404;; nl:6
    379405;; 2-I:1
    380 ;; c:8
    381 ;; u:6
     406;; c:7
     407;; u:9
    382408;; total format: 10
    383409
    384410;; alphabet usage stats
    385 ;; 58,::4
     411;; 58,::2
    386412;; 59,;:
    387413;; 60,<:
     
    390416;; 63,?:
    391417;; 64,@:1
    392 ;; 65,A:3
     418;; 65,A:4
    393419;; 66,B:11
    394 ;; 67,C:5
    395 ;; 68,D:12
    396 ;; 69,E:4
     420;; 67,C:4
     421;; 68,D:10
     422;; 69,E:3
    397423;; 70,F:3
    398424;; 71,G:
    399425;; 72,H:4
    400 ;; 73,I:3
     426;; 73,I:2
    401427;; 74,J:
    402 ;; 75,K:
     428;; 75,K:1
    403429;; 76,L:3
    404 ;; 77,M:4
     430;; 77,M:3
    405431;; 78,N:
    406 ;; 79,O:3
     432;; 79,O:2
    407433;; 80,P:1
    408434;; 81,Q:1
     
    422448;; 95,_:
    423449;; 96,`:
    424 ;; 97,a:7
     450;; 97,a:6
    425451;; 98,b:
    426 ;; 99,c:5
     452;; 99,c:4
    427453;; 100,d:4
    428 ;; 101,e:11
     454;; 101,e:9
    429455;; 102,f:2
    430456;; 103,g:2
     
    436462;; 109,m:1
    437463;; 110,n:9
    438 ;; 111,o:17
     464;; 111,o:18
    439465;; 112,p:3
    440466;; 113,q:
    441467;; 114,r:11
    442468;; 115,s:6
    443 ;; 116,t:13
    444 ;; 117,u:2
     469;; 116,t:11
     470;; 117,u:3
    445471;; 118,v:2
    446472;; 119,w:1
    447473;; 120,x:
    448474;; 121,y:2
    449 ;; alphabet used count: 39
     475;; alphabet used count: 40
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm

    r203 r233  
    124124
    125125;--------------------------------------------------------------------
    126 ; IterateToDptWithInterruptInServiceFlagSet
     126; IterateToDptWithFlagsHighInBL
    127127;   Parameters:
    128128;       DS:DI:  Ptr to DPT to examine
     129;       BL:     Bit(s) to test in DPT.bFlagsHigh
    129130;   Returns:
    130131;       CF:     Set if wanted DPT found
     
    134135;--------------------------------------------------------------------
    135136ALIGN JUMP_ALIGN
    136 IterateToDptWithInterruptInServiceFlagSet:
    137     test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_INTERRUPT_IN_SERVICE     ; Clears CF (but we need the clc
    138                                                                         ; below anyway for callers above)
     137IterateToDptWithFlagsHighInBL:     
     138    test    BYTE [di+DPT.bFlagsHigh], bl        ; Clears CF (but we need the clc
     139                                                ; below anyway for callers above)
    139140    jnz     SHORT ReturnRightDPT
    140141
     
    144145
    145146;--------------------------------------------------------------------
    146 ; FindDPT_ToDSDIforInterruptInService
     147; FindDPT_ToDSDIforSerialDevice
    147148;   Parameters:
    148149;       DS:     RAMVARS segment
     
    154155;       SI
    155156;--------------------------------------------------------------------
    156 ALIGN JUMP_ALIGN
    157 FindDPT_ToDSDIforInterruptInService:
    158     mov     si, IterateToDptWithInterruptInServiceFlagSet
     157ALIGN JUMP_ALIGN       
     158FindDPT_ToDSDIforSerialDevice:         
     159    mov     bl, FLGH_DPT_SERIAL_DEVICE
     160; fall-through
     161               
     162;--------------------------------------------------------------------
     163; FindDPT_ToDSDIforFlagsHigh
     164;   Parameters:
     165;       DS:     RAMVARS segment
     166;       BL:     Bit(s) to test in DPT.bFlagsHigh
     167;   Returns:
     168;       DS:DI:  Ptr to DPT
     169;       CF:     Set if wanted DPT found
     170;               Cleared if DPT not found
     171;   Corrupts registers:
     172;       SI
     173;--------------------------------------------------------------------
     174ALIGN JUMP_ALIGN
     175FindDPT_ToDSDIforFlagsHighInBL:     
     176    mov     si, IterateToDptWithFlagsHighInBL
    159177    ; Fall to IterateAllDPTs
    160178
  • 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.