Changeset 277 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS


Ignore:
Timestamp:
Feb 28, 2012, 2:45:48 PM (12 years ago)
Author:
gregli@…
google:author:
gregli@hotmail.com
Message:

Moved the bulk of the serial code to the assembly library, for inclusion in other utilities. Fixed a bug in int13h.asm when floppy support was not enabled that was preventing foreign drives from working properly.

Location:
trunk/XTIDE_Universal_BIOS
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Inc/ATA_ID.inc

    r258 r277  
    254254    .wRMSN      resw 1  ; 127F, Removable Media Status Notification feature set support
    255255    .wSecurity  resw 1  ; 128FV, Security Status
    256                 resw 158-129    ; 129...157X, Vendor Specific
    257     .wSerialFloppyFlagAndType:
    258     .wVendor1   resw 1  ; 158x, Vendor specific - word for use by the serial port code
    259     .wSerialPortAndBaud:
    260     .wVendor2   resw 1  ; 159X, Vendor Specific - word for use by the Serial Port code
     256                resw 160-129    ; 129...157X, Vendor Specific
    261257    .wCFAPower  resw 1  ; 160FV, CFA Power Mode 1
    262258                resw 176-161    ; 161...175R, Reserved for assignment by the CompactFlash Association
  • trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc

    r276 r277  
    118118ENABLE_WRITE_CACHE          EQU 2
    119119
    120 
    121 
    122 ;
    123 ; COM Number to I/O Port Address Mapping
    124 ;
    125 ; COM Number:                               1,    2,    3,    4,    5,    6,    7,    8,    9,   10,   11,   12
    126 ; Corresponds to I/O port:                3f8,  2f8,  3e8,  2e8,  2f0,  3e0,  2e0,  260,  368,  268,  360,  270
    127 ; Corresponds to Packed I/O port (hex):    37,   17,   35,   15,   16,   34,   14,    4,   25,    5,   24,    6
    128 ;
    129 DEVICE_SERIAL_COM1  EQU     3f8h
    130 DEVICE_SERIAL_COM2  EQU     2f8h
    131 DEVICE_SERIAL_COM3  EQU     3e8h
    132 DEVICE_SERIAL_COM4  EQU     2e8h
    133 DEVICE_SERIAL_COM5  EQU     2f0h
    134 DEVICE_SERIAL_COM6  EQU     3e0h
    135 DEVICE_SERIAL_COM7  EQU     2e0h
    136 DEVICE_SERIAL_COM8  EQU     260h
    137 DEVICE_SERIAL_COM9  EQU     368h
    138 DEVICE_SERIAL_COMA  EQU     268h
    139 DEVICE_SERIAL_COMB  EQU     360h
    140 DEVICE_SERIAL_COMC  EQU     270h
    141 
    142 
    143120%endif ; ROMVARS_INC
  • trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm

    r262 r277  
    44; Section containing code
    55SECTION .text
    6 
    7 ;--------------- UART Equates -----------------------------
    8 ;
    9 ; Serial Programming References:
    10 ;    http://en.wikibooks.org/wiki/Serial_Programming
    11 ;
    12 
    13 SerialCommand_UART_base                         EQU     0
    14 SerialCommand_UART_transmitByte                 EQU     0
    15 SerialCommand_UART_receiveByte                  EQU     0
    16 
    17 ;
    18 ; Values for UART_divisorLow:
    19 ; 60h = 1200, 30h = 2400, 18h = 4800, 0ch = 9600, 6 = 19200, 4 = 28800, 3 = 38400, 2 = 57600, 1 = 115200
    20 ;
    21 SerialCommand_UART_divisorLow                   EQU     0
    22 
    23 ;
    24 ; UART_divisorHigh is zero for all speeds including and above 1200 baud (which is all we do)
    25 ;
    26 SerialCommand_UART_divisorHigh                  EQU     1
    27 
    28 SerialCommand_UART_interruptIdent               EQU     2
    29 SerialCommand_UART_FIFOControl                  EQU     2
    30 
    31 SerialCommand_UART_lineControl                  EQU     3
    32 
    33 SerialCommand_UART_modemControl                 EQU     4
    34 
    35 SerialCommand_UART_lineStatus                   EQU     5
    36 
    37 SerialCommand_UART_modemStatus                  EQU     6
    38 
    39 SerialCommand_UART_scratch                      EQU     7
    40 
    41 SerialCommand_Protocol_Write                    EQU     3
    42 SerialCommand_Protocol_Read                     EQU     2
    43 SerialCommand_Protocol_Inquire                  EQU     0
    44 SerialCommand_Protocol_Header                   EQU     0a0h
    456
    467;--------------------------------------------------------------------
     
    6425SerialCommand_OutputWithParameters:
    6526
    66         mov     ah,(SerialCommand_Protocol_Header | SerialCommand_Protocol_Read)
     27        mov     ah,SerialServer_Command_Read
    6728
    6829        mov     al,[bp+IDEPACK.bCommand]
     
    7031        cmp     al,20h          ; Read Sectors IDE command
    7132        jz      .readOrWrite
    72         inc     ah              ; now SerialCommand_Protocol_Write
     33        inc     ah              ; now SerialServer_Protocol_Write
    7334        cmp     al,30h          ; Write Sectors IDE command
    7435        jz      .readOrWrite
     
    8546        mov     dx, [di+DPT_SERIAL.wSerialPortAndBaud]
    8647
    87 ; fall-through
     48        jmp     SerialServer_SendReceive
    8849
    89 ;--------------------------------------------------------------------
    90 ; SerialCommand_OutputWithParameters_DeviceInDX
    91 ;   Parameters:
    92 ;       AH:     Protocol Command
    93 ;       DX:     Packed I/O port and baud rate
    94 ;       ES:SI:  Ptr to buffer (for data transfer commands)
    95 ;       SS:BP:  Ptr to IDEREGS_AND_INTPACK
    96 ;   Returns:
    97 ;       AH:     INT 13h Error Code
    98 ;       CF:     Cleared if success, Set if error
    99 ;   Corrupts registers:
    100 ;       AL, BX, CX, DX, (ES:SI for data transfer commands)
    101 ;--------------------------------------------------------------------
    102 SerialCommand_OutputWithParameters_DeviceInDX:
    103 
    104         push    si
    105         push    di
    106         push    bp
    107 
    108 ;
    109 ; Unpack I/O port and baud from DPT
    110 ;       Port to DX for the remainder of the routine (+/- different register offsets)
    111 ;       Baud in CH until UART initialization is complete
    112 ;
    113         mov     ch,dh
    114         xor     dh,dh
    115         eSHL_IM dx, 2           ; shift from one byte to two
    116 
    117         mov     al,[bp+IDEPACK.bSectorCount]
    118 
    119 ;
    120 ; Command byte and sector count live at the top of the stack, pop/push are used to access
    121 ;
    122         push    ax
    123 
    124 %if 0
    125         cld     ; Shouldn't be needed. DF has already been cleared (line 24, Int13h.asm)
    126 %endif
    127 
    128 ;----------------------------------------------------------------------
    129 ;
    130 ; Initialize UART
    131 ;
    132 ; We do this each time since DOS (at boot) or another program may have
    133 ; decided to reprogram the UART
    134 ;
    135         mov     bl,dl           ; setup BL with proper values for read/write loops (BH comes later)
    136 
    137         mov     al,83h
    138         add     dl,SerialCommand_UART_lineControl
    139         out     dx,al
    140 
    141         mov     al,ch
    142         mov     dl,bl           ; divisor low
    143         out     dx,al
    144 
    145         xor     ax,ax
    146         inc     dx              ; divisor high
    147         push    dx
    148         out     dx,al
    149 
    150         mov     al,047h
    151         inc     dx              ;  fifo
    152         out     dx,al
    153 
    154         mov     al,03h
    155         inc     dx              ;  linecontrol
    156         out     dx,al
    157 
    158         mov     al,0bh
    159         inc     dx              ;  modemcontrol
    160         out     dx,al
    161 
    162         inc     dx              ;  linestatus (no output now, just setting up BH for later use)
    163         mov     bh,dl
    164 
    165         pop     dx              ; base, interrupts disabled
    166         xor     ax,ax
    167         out     dx,al
    168 
    169 ;----------------------------------------------------------------------
    170 ;
    171 ; Send Command
    172 ;
    173 ; Sends first six bytes of IDEREGS_AND_INTPACK as the command
    174 ;
    175         push    es              ; save off real buffer location
    176         push    si
    177 
    178         mov     si,bp           ; point to IDEREGS for command dispatch;
    179         push    ss
    180         pop     es
    181 
    182         mov     di,0ffffh       ; initialize checksum for write
    183         mov     bp,di
    184 
    185         mov     cx,4            ; writing 3 words (plus 1)
    186 
    187         cli                     ; interrupts off...
    188 
    189         call    SerialCommand_WriteProtocol.entry
    190 
    191         pop     di              ; restore real buffer location (note change from SI to DI)
    192                                 ; Buffer is primarily referenced through ES:DI throughout, since
    193                                 ; we need to store (read sector) faster than we read (write sector)
    194         pop     es
    195 
    196 %if 0
    197 ;;; no longer needed, since the pointer is normalized before we are called and we do not support
    198 ;;; more than 128 sectors (and for 128 specifically, the pointer must be segment aligned).
    199 ;;; See comments below at the point this entry point was called for more details...
    200 .nextSectorNormalize:
    201         call    Registers_NormalizeESDI
    202 %endif
    203 
    204         pop     ax              ; load command byte (done before call to .nextSector on subsequent iterations)
    205         push    ax
    206 
    207 ;
    208 ; Top of the read/write loop, one iteration per sector
    209 ;
    210 .nextSector:
    211         mov     si,0ffffh       ; initialize checksum for read or write
    212         mov     bp,si
    213 
    214         mov     cx,0101h        ; writing 256 words (plus 1)
    215 
    216         shr     ah,1            ; command byte, are we doing a write?
    217         jnc     .readEntry
    218 
    219         xchg    si,di
    220         call    SerialCommand_WriteProtocol.entry
    221         xchg    si,di
    222 
    223         inc     cx              ; CX = 1 now (0 out of WriteProtocol)
    224         jmp     .readEntry
    225 
    226 ;----------------------------------------------------------------------
    227 ;
    228 ; Timeout
    229 ;
    230 ; To save code space, we use the contents of DL to decide which byte in the word to return for reading.
    231 ;
    232 .readTimeout:
    233         push    ax              ; not only does this push preserve AX (which we need), but it also
    234                                 ; means the stack has the same number of bytes on it as when we are
    235                                 ; sending a packet, important for error cleanup and exit
    236         mov     ah,1
    237         call    SerialCommand_WaitAndPoll_Read
    238         pop     ax
    239         test    dl,1
    240         jz      .readByte1Ready
    241         jmp     .readByte2Ready
    242 
    243 ;----------------------------------------------------------------------------
    244 ;
    245 ; Read Block (without interrupts, used when there is a FIFO, high speed)
    246 ;
    247 ; NOTE: This loop is very time sensitive.  Literally, another instruction
    248 ; cannot be inserted into this loop without us falling behind at high
    249 ; speed (460.8K baud) on a 4.77Mhz 8088, making it hard to receive
    250 ; a full 512 byte block.
    251 ;
    252 .readLoop:
    253         stosw                   ; store word in caller's data buffer
    254 
    255         add     bp, ax          ; update Fletcher's checksum
    256         adc     bp, 0
    257         add     si, bp
    258         adc     si, 0
    259 
    260 .readEntry:
    261         mov     dl,bh
    262         in      al,dx
    263         shr     al,1            ; data ready (byte 1)?
    264         mov     dl,bl           ; get ready to read data
    265         jnc     .readTimeout    ; nope not ready, update timeouts
    266 
    267 ;
    268 ; Entry point after initial timeout.  We enter here so that the checksum word
    269 ; is not stored (and is left in AX after the loop is complete).
    270 ;
    271 .readByte1Ready:
    272         in      al, dx          ; read data byte 1
    273 
    274         mov     ah, al          ; store byte in ah for now
    275 
    276 ;
    277 ; note the placement of this reset of dl to bh, and that it is
    278 ; before the return, which is assymetric with where this is done
    279 ; above for byte 1.  The value of dl is used by the timeout routine
    280 ; to know which byte to return to (.read_byte1_ready or
    281 ; .read_byte2_ready)
    282 ;
    283         mov     dl,bh
    284 
    285         in      al,dx
    286         shr     al,1            ; data ready (byte 2)?
    287         jnc     .readTimeout
    288 .readByte2Ready:
    289         mov     dl,bl
    290         in      al, dx          ; read data byte 2
    291 
    292         xchg    al, ah          ; ah was holding byte 1, reverse byte order
    293 
    294         loop    .readLoop
    295 
    296         sti                     ; interrupts back on ASAP, between packets
    297 
    298 ;
    299 ; Compare checksums
    300 ;
    301         xchg    ax,bp
    302         xor     ah,al
    303         mov     cx,si
    304         xor     cl,ch
    305         mov     al,cl
    306         cmp     ax,bp
    307         jnz     SerialCommand_OutputWithParameters_Error
    308 
    309         pop     ax              ; sector count and command byte
    310         dec     al              ; decrement sector count
    311         push    ax              ; save
    312         jz      SerialCommand_OutputWithParameters_ReturnCodeInAL
    313 
    314         cli                     ; interrupts back off for ACK byte to host
    315                                 ; (host could start sending data immediately)
    316         out     dx,al           ; ACK with next sector number
    317 
    318 %if 0
    319 ;;; This code is no longer needed as we do not support more than 128 sectors, and for 128 the pointer
    320 ;;; must be segment aligned.  If we ever do want to support more sectors, the code can help...
    321 
    322 ;
    323 ; Normalize buffer pointer for next go round, if needed.
    324 ;
    325 ; We need to re-normalize the pointer in ES:DI after processing every 7f sectors.  That number could
    326 ; have been 80 if we knew the offset was on a segment boundary, but this may not be the case.
    327 ;
    328 ; We re-normalize based on the sector count (flags from "dec al" above)...
    329 ;    a) we normalize before the first sector goes out, immediately after sending the command packet (above)
    330 ;    b) on transitions from FF to FE, very rare case for writing 255 or 256 sectors
    331 ;    c) on transitions from 80 to 7F, a large read/write
    332 ;    d) on transitions from 00 to FF, very, very rare case of writing 256 sectors
    333 ;       We don't need to renormalize in this case, but it isn't worth the memory/effort to not do
    334 ;       the extra work, and it does no harm.
    335 ;
    336 ; I really don't care much about (d) because I have not seen cases where any OS makes a request
    337 ; for more than 127 sectors.  Back in the day, it appears that some BIOS could not support more than 127
    338 ; sectors, so that may be the practical limit for OS and application developers.  The Extended BIOS
    339 ; function also appear to be capped at 127 sectors.  So although this can support the full 256 sectors
    340 ; if needed, we are optimized for that 1-127 range.
    341 ;
    342 ; Assume we start with 0000:000f, with 256 sectors to write...
    343 ;    After first packet, 0000:020f
    344 ;    First decrement of AL, transition from 00 to FF: renormalize to 0020:000f (unnecessary)
    345 ;    After second packet, 0020:020f
    346 ;    Second derement of AL, transition from FF to FE: renormalize to 0040:000f
    347 ;    After 7f more packets, 0040:fe0f
    348 ;    Decrement of AL, transition from 80 to 7F: renormalize to 1020:000f
    349 ;    After 7f more packets, 1020:fe0f or 2000:000f if normalized
    350 ;    Decrement of AL, from 1 to 0: exit
    351 ;
    352         jge     short .nextSector       ; OF=SF, branch for 1-7e, most common case
    353                                         ; (0 kicked out above for return success)
    354 
    355         add     al,2                    ; 7f-ff moves to 81-01
    356                                         ; (0-7e kicked out before we get here)
    357                                         ; 7f moves to 81 and OF=1, so OF=SF
    358                                         ; fe moves to 0 and OF=0, SF=0, so OF=SF
    359                                         ; ff moves to 1 and OF=0, SF=0, so OF=SF
    360                                         ; 80-fd moves to 82-ff and OF=0, so OF<>SF
    361 
    362         jl      short .nextSector       ; OF<>SF, branch for all cases but 7f, fe, and ff
    363 
    364 ;       jpo     short .nextSector       ; if we really wanted to avoid normalizing for ff, this
    365                                         ; is one way to do it, but it adds more memory and more
    366                                         ; cycles for the 7f and fe cases.  IMHO, given that I've
    367                                         ; never seen a request for more than 7f, this seems unnecessary.
    368 
    369         jmp     short .nextSectorNormalize  ; our two renormalization cases (plus one for ff)
    370 
    371 %else
    372 
    373         jmp     short .nextSector
    374 
    375 %endif
    376 
    377 ;---------------------------------------------------------------------------
    378 ;
    379 ; Cleanup, error reporting, and exit
    380 ;
    381 
    382 ;
    383 ; Used in situations where a call is underway, such as with SerialCommand_WaitAndPoll
    384 ;
    385 ALIGN JUMP_ALIGN
    386 SerialCommand_OutputWithParameters_ErrorAndPop4Words:
    387         add     sp,8
    388 ;;; fall-through
    389 
    390 ALIGN JUMP_ALIGN
    391 SerialCommand_OutputWithParameters_Error:
    392 ;----------------------------------------------------------------------
    393 ;
    394 ; Clear read buffer
    395 ;
    396 ; In case there are extra characters or an error in the FIFO, clear it out.
    397 ; In theory the initialization of the UART registers above should have
    398 ; taken care of this, but I have seen cases where this is not true.
    399 ;
    400         xor     cx,cx                   ; timeout this clearing routine, in case the UART isn't there
    401 .clearBuffer:
    402         mov     dl,bh
    403         in      al,dx
    404         mov     dl,bl
    405         test    al,08fh
    406         jz      .clearBufferComplete
    407         test    al,1
    408         in      al,dx
    409         loopnz  .clearBuffer            ; note ZF from test above
    410 
    411 .clearBufferComplete:
    412         mov     al, 3           ;  error return code and CF (low order bit)
    413 
    414 ALIGN JUMP_ALIGN
    415 SerialCommand_OutputWithParameters_ReturnCodeInAL:
    416 %if 0
    417         sti                     ;  all paths here will already have interrupts turned back on
    418 %endif
    419         mov     ah, al          ;  for success, AL will already be zero
    420 
    421         pop     bx              ;  recover "ax" (command and count) from stack
    422 
    423         pop     bp
    424         pop     di
    425         pop     si
    426 
    427         mov     ch, 0
    428         mov     cl,[bp+IDEPACK.bSectorCount]
    429         sub     cl, bl          ; subtract off the number of sectors that remained
    430        
    431         shr     ah, 1           ; shift down return code and CF
    432 
    433         ret
    434 
    435 ;--------------------------------------------------------------------
    436 ; SerialCommand_WriteProtocol
    437 ;
    438 ; NOTE: As with its read counterpart, this loop is very time sensitive.
    439 ; Although it will still function, adding additional instructions will
    440 ; impact the write throughput, especially on slower machines.
    441 ;
    442 ;   Parameters:
    443 ;       ES:SI:  Ptr to buffer
    444 ;       CX:     Words to write, plus 1
    445 ;       BP/DI:  Initialized for Checksum (-1 in each)
    446 ;       DH:     I/O Port high byte
    447 ;       BX:     LineStatus Register address (BH) and Receive/Transmit Register address (BL)
    448 ;   Returns:
    449 ;       BP/DI:  Checksum for written bytes, compared against ACK from server in .readLoop
    450 ;       CX:     Zero
    451 ;       DL:     Receive/Transmit Register address
    452 ;   Corrupts registers:
    453 ;       AX
    454 ;--------------------------------------------------------------------
    455 ALIGN JUMP_ALIGN
    456 SerialCommand_WriteProtocol:
    457 .writeLoop:
    458         es lodsw                ; fetch next word
    459 
    460         out     dx,al           ; output first byte
    461 
    462         add     bp,ax           ; update checksum
    463         adc     bp,0
    464         add     di,bp
    465         adc     di,0
    466 
    467         mov     dl,bh           ; transmit buffer empty?
    468         in      al,dx
    469         test    al,20h
    470         jz      .writeTimeout2  ; nope, use our polling routine
    471 
    472 .writeByte2Ready:
    473         mov     dl,bl
    474         mov     al,ah           ; output second byte
    475         out     dx,al
    476 
    477 .entry:
    478         mov     dl,bh           ; transmit buffer empty?
    479         in      al,dx
    480         test    al,20h
    481         mov     dl,bl
    482         jz      .writeTimeout1  ; nope, use our polling routine
    483 
    484 .writeByte1Ready:
    485         loop    .writeLoop
    486 
    487         mov     ax,di           ; fold Fletcher's checksum and output
    488         xor     al,ah
    489         out     dx,al           ; byte 1
    490 
    491         call    SerialCommand_WaitAndPoll_Write
    492 
    493         mov     ax,bp
    494         xor     al,ah
    495         out     dx,al           ; byte 2
    496 
    497         ret
    498 
    499 .writeTimeout2:
    500         mov     dl,ah           ; need to preserve AH, but don't need DL (will be reset upon return)
    501         call    SerialCommand_WaitAndPoll_Write
    502         mov     ah,dl
    503         jmp     .writeByte2Ready
    504 
    505 .writeTimeout1:
    506 %ifndef USE_186
    507         mov     ax,.writeByte1Ready
    508         push    ax              ; return address for ret at end of SC_writeTimeout2
    509 %else
    510         push    .writeByte1Ready
    511 %endif
    512 ;;; fall-through
    513 
    514 ;--------------------------------------------------------------------
    515 ; SerialCommand_WaitAndPoll
    516 ;
    517 ;   Parameters:
    518 ;       AH:     UART_LineStatus bit to test (20h for write, or 1h for read)
    519 ;               One entry point fills in AH with 20h for write
    520 ;       DX:     Port address (OK if already incremented to UART_lineStatus)
    521 ;       BX:
    522 ;       Stack:  2 words on the stack below the command/count word
    523 ;   Returns:
    524 ;       Returns when desired UART_LineStatus bit is cleared
    525 ;       Jumps directly to error exit if timeout elapses (and cleans up stack)
    526 ;   Corrupts registers:
    527 ;       AX
    528 ;--------------------------------------------------------------------
    529 
    530 SerialCommand_WaitAndPoll_SoftDelayTicks   EQU   20
    531 
    532 ALIGN JUMP_ALIGN
    533 SerialCommand_WaitAndPoll_Write:
    534         mov     ah,20h
    535 ;;; fall-through
    536 
    537 ALIGN JUMP_ALIGN
    538 SerialCommand_WaitAndPoll_Read:
    539         push    cx
    540         push    dx
    541 
    542 ;
    543 ; We first poll in a tight loop, interrupts off, for the next character to come in/be sent
    544 ;
    545         xor     cx,cx
    546 .readTimeoutLoop:
    547         mov     dl,bh
    548         in      al,dx
    549         test    al,ah
    550         jnz     .readTimeoutComplete
    551         loop    .readTimeoutLoop
    552 
    553 ;
    554 ; If that loop completes, then we assume there is a long delay involved, turn interrupts back on
    555 ; and wait for a given number of timer ticks to pass.
    556 ;
    557         sti
    558         mov     cl,SerialCommand_WaitAndPoll_SoftDelayTicks
    559         call    Timer_InitializeTimeoutWithTicksInCL
    560 .WaitAndPoll:
    561         call    Timer_SetCFifTimeout
    562         jc      SerialCommand_OutputWithParameters_ErrorAndPop4Words
    563         in      al,dx
    564         test    al,ah
    565         jz      .WaitAndPoll
    566         cli
    567 
    568 .readTimeoutComplete:
    569         pop     dx
    570         pop     cx
    571         ret
    57250
    57351;--------------------------------------------------------------------
     
    57957;       CS:BP:  Ptr to IDEVARS
    58058;   Returns:
    581 ;       AH:     INT 13h Error Code
    582 ;               NOTE: Not set (or checked) during drive detection
    58359;       CF:     Cleared if success, Set if error
    58460;   Corrupts registers:
     
    632108;     master scan.
    633109;
    634         mov     cx,1            ; 1 sector to move, 0 for non-scan
    635110        mov     dx,[cs:bp+IDEVARS.wSerialPortAndBaud]
    636111        xor     ax,ax
     112       
    637113        push    si
    638114        call    FindDPT_ToDSDIforSerialDevice
     
    642118;
    643119; If not found above with FindDPT_ToDSDIforSerialDevice, DI will point to the DPT after the last hard disk DPT
     120; So, if there was a previously found floppy disk, DI will point to that DPT and we use that value for the slave.
    644121;
    645122        cmp     byte [RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst], 0
     
    647124.founddpt:
    648125%else
    649         jnc     .notfounddpt
     126        jc      .notfounddpt
    650127%endif
    651128        mov     ax, [di+DPT_SERIAL.wSerialPortAndBaud]
     
    656133
    657134        test    ax,ax           ; Take care of the case that is different between master and slave.
    658         jz      .error          ; Because we do this here, the jz after the "or" below will not be taken
     135        jz      .error         
    659136
    660137; fall-through
     
    663140        jnz     .identifyDeviceInDX
    664141
    665         or      dx,ax           ; Since DX is zero, this effectively moves the previously found serial drive
    666                                 ; information to dx, as well as test for zero
    667         jz      .scanSerial
     142        xchg    dx, ax          ;  move ax to dx (move previously found serial drive to dx, could be zero)
    668143
    669 ; fall-through
    670 .identifyDeviceInDX:
    671 
    672         push    bp              ; setup fake IDEREGS_AND_INTPACK
    673 
    674         push    dx
    675 
    676         push    cx
    677 
    678         mov     bl,0a0h         ; protocol command to ah and onto stack with bh
    679         mov     ah,bl
    680 
    681         push    bx
    682 
    683         mov     bp,sp
    684         call    SerialCommand_OutputWithParameters_DeviceInDX
    685 
    686         pop     bx
    687 
    688         pop     cx
    689         pop     dx
    690 
    691         pop     bp
    692 ;
    693 ; place port and baud word in to the return sector, in a vendor specific area,
    694 ; which is read by FinalizeDPT and DetectDrives
    695 ;
    696         mov     [es:si+ATA6.wSerialPortAndBaud],dx
    697 
    698 .notFound:
    699         ret
    700 
    701 ;----------------------------------------------------------------------
    702 ;
    703 ; SerialCommand_AutoSerial
    704 ;
    705 ; When the SerialAuto IDEVARS entry is used, scans the COM ports on the machine for a possible serial connection.
    706 ;
    707 
    708 .scanPortAddresses: db  DEVICE_SERIAL_COM7 >> 2
    709                     db  DEVICE_SERIAL_COM6 >> 2
    710                     db  DEVICE_SERIAL_COM5 >> 2
    711                     db  DEVICE_SERIAL_COM4 >> 2
    712                     db  DEVICE_SERIAL_COM3 >> 2
    713                     db  DEVICE_SERIAL_COM2 >> 2
    714                     db  DEVICE_SERIAL_COM1 >> 2
    715                     db  0
    716 
    717 ALIGN JUMP_ALIGN
    718 .scanSerial:
    719         mov     di,.scanPortAddresses-1
    720         mov     ch,1            ;  tell server that we are scanning
    721 
    722 .nextPort:
    723         inc     di              ; load next port address
    724         xor     dh, dh
    725         mov     dl,[cs:di]
    726         eSHL_IM dx, 2           ; shift from one byte to two
    727         jz      .error
    728 
    729 ;
    730 ; Test for COM port presence, write to and read from registers
    731 ;
    732         push    dx
    733         add     dl,SerialCommand_UART_lineControl
    734         mov     al, 09ah
    735         out     dx, al
    736         in      al, dx
    737         pop     dx
    738         cmp     al, 09ah
    739         jnz     .nextPort
    740 
    741         mov     al, 0ch
    742         out     dx, al
    743         in      al, dx
    744         cmp     al, 0ch
    745         jnz     .nextPort
    746 
    747 ;
    748 ; Begin baud rate scan on this port...
    749 ;
    750 ; On a scan, we support 6 baud rates, starting here and going higher by a factor of two each step, with a
    751 ; small jump between 9600 and 38800.  These 6 were selected since we wanted to support 9600 baud and 115200,
    752 ; *on the server side* if the client side had a 4x clock multiplier, a 2x clock multiplier, or no clock multiplier.
    753 ;
    754 ; Starting with 30h, that means 30h (2400 baud), 18h (4800 baud), 0ch (9600 baud), and
    755 ;                               04h (28800 baud), 02h (57600 baud), 01h (115200 baud)
    756 ;
    757 ; Note: hardware baud multipliers (2x, 4x) will impact the final baud rate and are not known at this level
    758 ;
    759         mov     dh,030h * 2     ; multiply by 2 since we are about to divide by 2
    760         mov     dl,[cs:di]      ; restore single byte port address for scan
    761 
    762 .nextBaud:
    763         shr     dh,1
    764         jz      .nextPort
    765         cmp     dh,6            ; skip from 6 to 4, to move from the top of the 9600 baud range
    766         jnz     .testBaud       ; to the bottom of the 115200 baud range
    767         mov     dh,4
    768 
    769 .testBaud:
    770         call    .identifyDeviceInDX
    771         jc      .nextBaud
    772 
    773         ret
     144.identifyDeviceInDX:   
     145        jmp     SerialServerScan_ScanForServer
    774146
    775147.error:
    776148        stc
    777 %if 0
    778         mov     ah,1        ; setting the error code is unnecessary as this path can only be taken during
    779                             ; drive detection, and drive detection works off CF and does not check AH
    780 %endif
    781149        ret
    782 
    783 
  • trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialDPT.asm

    r258 r277  
    1717;--------------------------------------------------------------------
    1818SerialDPT_Finalize:
    19         mov     ax, [es:si+ATA6.wSerialPortAndBaud]
     19        mov     ax, [es:si+SerialServer_ATA_wPortAndBaud]
    2020        mov     [di+DPT_SERIAL.wSerialPortAndBaud], ax
    2121
    2222;
    2323; Note that this section is not under %ifdef MODULE_SERIAL_FLOPPY.  It is important to
    24 ; detect floppy disks presented by the server and not treat them like hard disks, even
     24; distinguish floppy disks presented by the server and not treat them as hard disks, even
    2525; if the floppy support is disabled.
    2626;
    27         mov     al, [es:si+ATA6.wSerialFloppyFlagAndType]
     27        mov     al, [es:si+SerialServer_ATA_wFloppyFlagAndType]
    2828        or      al, FLGH_DPT_SERIAL_DEVICE
    2929        or      byte [di+DPT.bFlagsHigh], al
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm

    r263 r277  
    3636    jz      short .OurFunction                      ; we handle all function 0h requests (resets)
    3737    cmp     ah, 8
    38 %ifdef MODULE_SERIAL_FLOPPY
    39     jnz     SHORT Int13h_DirectCallToAnotherBios    ; we handle all traffic for function 08h,
    40                                                     ; as we need to wrap both hard disk and floppy drive counts
    41 %else
    42     jz      SHORT .OurFunction                      ; we handle all *hard disk* (only) traffic for function 08h,
    43                                                     ; as we need to wrap the hard disk drive count
    44     test    dl, dl
     38    jnz     SHORT Int13h_DirectCallToAnotherBios    ; non-8h function, handled by foreign bios
     39
     40%ifndef MODULE_SERIAL_FLOPPY
     41; With floppy support, we handle all traffic for function 08h, as we need to wrap both hard disk and
     42; floppy drive counts.  Without floppy support, we handle only hard disk traffic for function 08h,
     43; and thus need the check below.
     44;
     45    test    dl, dl                             
    4546    jns     SHORT Int13h_DirectCallToAnotherBios
    4647%endif     
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm

    r262 r277  
    5757                                            ; on the same 256 byte page, which is checked in strings.asm.
    5858
     59%ifdef MODULE_SERIAL
    5960    cmp     dh, DEVICE_SERIAL_PORT          ; Check if this is a serial device
    6061
     
    9596
    9697.pushAndPrintSerial:   
    97     mov     si, g_szDetectOuterSerial       ; Finally load SI with wrapper string "Serial %s on %s: "       
     98    mov     si, g_szDetectOuterSerial       ; Finally load SI with wrapper string "Serial %s on %s: "
    9899
    99100.pushAndPrint:
     101%endif
     102       
    100103    push    cx                              ; Push print string
    101104    push    ax                              ; Push high order digits, or port address, or N/A
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r276 r277  
    1616
    1717%define MENUEVENT_INLINE_OFFSETS    ; Only one menu required, save space and inline offsets
     18
     19%ifdef MODULE_SERIAL
     20%define INCLUDE_SERIALSERVER_LIBRARY
     21%endif
    1822       
    1923    ; Included .inc files
  • trunk/XTIDE_Universal_BIOS/Src/Strings.asm

    r262 r277  
    88; Section containing code
    99SECTION .text
    10 
    11 ; The following strings are used by DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP
    12 ; To support an optimization in that code, these strings must start on the same 256 byte page,
    13 ; which is checked at assembly time below.
    14 ;
    15 g_szDetectStart:
    16 g_szDetectMaster:       db  "Master",NULL
    17 g_szDetectSlave:        db  "Slave ",NULL
    18 g_szDetectOuter:        db  "IDE %s at %s: ",NULL
    19 g_szDetectOuterSerial:  db  "Serial %s on %s: ",NULL       
    20 g_szDetectPort:         db  "%x",NULL                       ; IDE Master at 1F0h:
    21 g_szDetectCOM:          db  "COM%c%s",NULL
    22 g_szDetectCOMAuto:      db  " Detect",NULL
    23 g_szDetectCOMSmall:     db  "/%u%u00",NULL                  ; IDE Master at COM1/9600:
    24 g_szDetectEnd:
    25 g_szDetectCOMLarge:     db  "/%u.%uK",NULL                  ; IDE Master at COM1/19.2K:
    26 
    27 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
    28     %if ((g_szDetectEnd-$$) & 0xff00) <> ((g_szDetectStart-$$) & 0xff00)
    29         %error "g_szDetect* strings must start on the same 256 byte page, required by DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP.  Please move this block up or down within strings.asm"
    30     %endif
    31 %endif
    32 
    33 ; Boot Menu menuitem strings
    34 ;
    35 ; The following strings are used by BootMenuPrint_* routines.
    36 ; To support optimizations in that code, these strings must start on the same 256 byte page,
    37 ; which is checked at assembly time below.
    38 ;
    39 g_szBootMenuPrintStart:
    40 g_szDriveNum:           db  "%x %s",NULL
    41 g_szDriveNumBOOTNFO:    db  "%x %z",NULL
    42 g_szFloppyDrv:          db  "Floppy Drive %c",NULL
    43 g_szBootMenuPrintEnd:
    44 g_szForeignHD:          db  "Foreign Hard Disk",NULL
    45 
    46 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
    47     %if ((g_szBootMenuPrintStart-$$) & 0xff00) <> ((g_szBootMenuPrintEnd-$$) & 0xff00)
    48         %error "g_szBootMenuPrint* strings must start on the same 256 byte page, required by the BootMenuPrint_* routines.  Please move this block up or down within strings.asm"
    49     %endif
    50 %endif
    5110
    5211; POST drive detection strings
     
    5817g_szNotFound:           db  "not found",LF,CR,NULL
    5918g_szReadError:          db  "Error %x!",LF,CR,NULL
    60 
    61 ; Boot menu bottom of screen strings
    62 g_szFDD:        db  "FDD     ",NULL
    63 g_szHDD:        db  "HDD     ",NULL
    64 g_szRomBoot:    db  "ROM Boot",NULL
    65 g_szHotkey:     db  "%A%c%c%A%s%A ",NULL
    66 
    67 ; Boot Menu information strings
    68 g_szCapacity:           db  "Capacity : %s",NULL
    69 g_szCapacityNum:        db  "%5-u.%u %ciB",NULL
    70 g_szInformation:        db  "%s",LF,CR
    71     db  "Addr.",SINGLE_VERTICAL,"Block",SINGLE_VERTICAL,"Bus",SINGLE_VERTICAL,  "IRQ",SINGLE_VERTICAL,"Reset",LF,CR
    72     db     "%s",SINGLE_VERTICAL, "%5-u",SINGLE_VERTICAL, "%s",SINGLE_VERTICAL," %2-I",SINGLE_VERTICAL,"%5-x" ,NULL
    7319
    7420g_szAddressingModes:
     
    15197    %endif
    15298%endif
     99
     100; The following strings are used by DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP
     101; To support an optimization in that code, these strings must start on the same 256 byte page,
     102; which is checked at assembly time below.
     103;
     104g_szDetectStart:
     105g_szDetectMaster:       db  "Master",NULL
     106g_szDetectSlave:        db  "Slave ",NULL
     107g_szDetectOuter:        db  "IDE %s at %s: ",NULL
     108;%%; %ifdef MODULE_SERIAL       ;%%; is stripped off after string compression, %ifdef won't compress properly
     109g_szDetectOuterSerial:  db  "Serial %s on %s: ",NULL
     110g_szDetectCOM:          db  "COM%c%s",NULL
     111g_szDetectCOMAuto:      db  " Detect",NULL
     112g_szDetectCOMSmall:     db  "/%u%u00",NULL                  ; IDE Master at COM1/9600:
     113g_szDetectCOMLarge:     db  "/%u.%uK",NULL                  ; IDE Master at COM1/19.2K:
     114;%%; %endif                     ;%%; is stripped off after string compression, %ifdef won't compress properly
     115g_szDetectEnd:
     116g_szDetectPort:         db  "%x",NULL                       ; IDE Master at 1F0h:
     117
     118%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
     119    %if ((g_szDetectEnd-$$) & 0xff00) <> ((g_szDetectStart-$$) & 0xff00)
     120        %error "g_szDetect* strings must start on the same 256 byte page, required by DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP.  Please move this block up or down within strings.asm"
     121    %endif
     122%endif
     123
     124; Boot Menu menuitem strings
     125;
     126; The following strings are used by BootMenuPrint_* routines.
     127; To support optimizations in that code, these strings must start on the same 256 byte page,
     128; which is checked at assembly time below.
     129;
     130g_szBootMenuPrintStart:
     131g_szDriveNum:           db  "%x %s",NULL
     132g_szDriveNumBOOTNFO:    db  "%x %z",NULL
     133g_szFloppyDrv:          db  "Floppy Drive %c",NULL
     134g_szBootMenuPrintEnd:
     135g_szForeignHD:          db  "Foreign Hard Disk",NULL
     136
     137%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
     138    %if ((g_szBootMenuPrintStart-$$) & 0xff00) <> ((g_szBootMenuPrintEnd-$$) & 0xff00)
     139        %error "g_szBootMenuPrint* strings must start on the same 256 byte page, required by the BootMenuPrint_* routines.  Please move this block up or down within strings.asm"
     140    %endif
     141%endif
     142
     143; Boot menu bottom of screen strings
     144g_szFDD:        db  "FDD     ",NULL
     145g_szHDD:        db  "HDD     ",NULL
     146g_szRomBoot:    db  "ROM Boot",NULL
     147g_szHotkey:     db  "%A%c%c%A%s%A ",NULL
     148
     149; Boot Menu information strings
     150g_szCapacity:           db  "Capacity : %s",NULL
     151g_szCapacityNum:        db  "%5-u.%u %ciB",NULL
     152g_szInformation:        db  "%s",LF,CR
     153    db  "Addr.",SINGLE_VERTICAL,"Block",SINGLE_VERTICAL,"Bus",SINGLE_VERTICAL,  "IRQ",SINGLE_VERTICAL,"Reset",LF,CR
     154    db     "%s",SINGLE_VERTICAL, "%5-u",SINGLE_VERTICAL, "%s",SINGLE_VERTICAL," %2-I",SINGLE_VERTICAL,"%5-x" ,NULL
    153155
    154156;------------------------------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS/Src/StringsCompressed.asm

    r262 r277  
    1717SECTION .text
    1818
     19; POST drive detection strings
     20g_szRomAt:      ; db    "%s @ %x",LF,CR,NULL
     21                ; db     25h,  73h,  20h,  40h,  20h,  25h,  78h,  0ah,  0dh,  00h    ; uncompressed
     22                  db     3eh,  20h, 0c6h,  39h,  1bh                                  ; compressed
     23
     24
     25; Boot loader strings
     26g_szTryToBoot:          ; db    "Booting from %s %x",ANGLE_QUOTE_RIGHT,"%x",LF,CR,NULL
     27                        ; 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
     28                          db     48h,  75h,  75h,  7ah,  6fh,  74h, 0edh,  6ch,  78h,  75h, 0f3h,  3eh,  20h,  39h,  24h,  39h,  1bh                                              ; compressed
     29
     30g_szBootSectorNotFound: ; db    "Boot sector "
     31                        ; db     42h,  6fh,  6fh,  74h,  20h,  73h,  65h,  63h,  74h,  6fh,  72h,  20h    ; uncompressed
     32                          db     48h,  75h,  75h, 0fah,  79h,  6bh,  69h,  7ah,  75h, 0f8h                ; compressed
     33
     34g_szNotFound:           ; db    "not found",LF,CR,NULL
     35                        ; db     6eh,  6fh,  74h,  20h,  66h,  6fh,  75h,  6eh,  64h,  0ah,  0dh,  00h    ; uncompressed
     36                          db     74h,  75h, 0fah,  6ch,  75h,  7bh,  74h,  6ah,  1bh                      ; compressed
     37
     38g_szReadError:          ; db    "Error %x!",LF,CR,NULL
     39                        ; db     45h,  72h,  72h,  6fh,  72h,  20h,  25h,  78h,  21h,  0ah,  0dh,  00h    ; uncompressed
     40                          db     4bh,  78h,  78h,  75h, 0f8h,  39h,  25h,  1bh                            ; compressed
     41
     42
     43g_szAddressingModes:
     44g_szLCHS:       ; db    "L-CHS",NULL
     45                ; db     4ch,  2dh,  43h,  48h,  53h,  00h    ; uncompressed
     46                  db     52h,  28h,  49h,  4eh,  99h          ; compressed
     47
     48g_szPCHS:       ; db    "P-CHS",NULL
     49                ; db     50h,  2dh,  43h,  48h,  53h,  00h    ; uncompressed
     50                  db     56h,  28h,  49h,  4eh,  99h          ; compressed
     51
     52g_szLBA28:      ; db    "LBA28",NULL
     53                ; db     4ch,  42h,  41h,  32h,  38h,  00h    ; uncompressed
     54                  db     52h,  48h,  47h,  2ch,  11h          ; compressed
     55
     56g_szLBA48:      ; db    "LBA48",NULL
     57                ; db     4ch,  42h,  41h,  34h,  38h,  00h    ; uncompressed
     58                  db     52h,  48h,  47h,  2eh,  11h          ; compressed
     59
     60g_szAddressingModes_Displacement equ (g_szPCHS - g_szAddressingModes)
     61;
     62; Ensure that addressing modes are correctly spaced in memory
     63;
     64%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
     65%if g_szLCHS <> g_szAddressingModes
     66%error "g_szAddressingModes Displacement Incorrect 1"
     67%endif
     68%if g_szPCHS <> g_szLCHS + g_szAddressingModes_Displacement
     69%error "g_szAddressingModes Displacement Incorrect 2"
     70%endif
     71%if g_szLBA28 <> g_szPCHS + g_szAddressingModes_Displacement
     72%error "g_szAddressingModes Displacement Incorrect 3"
     73%endif
     74%if g_szLBA48 <> g_szLBA28 + g_szAddressingModes_Displacement
     75%error "g_szAddressingModes Displacement Incorrect 4"
     76%endif
     77%endif
     78
     79g_szBusTypeValues:
     80g_szBusTypeValues_8Dual:        ; db        "D8 ",NULL
     81                                ; db         44h,  38h,  20h,  00h    ; uncompressed
     82                                  db         4ah,  31h,  00h          ; compressed
     83
     84g_szBusTypeValues_8Reversed:    ; db        "X8 ",NULL
     85                                ; db         58h,  38h,  20h,  00h    ; uncompressed
     86                                  db         5eh,  31h,  00h          ; compressed
     87
     88g_szBusTypeValues_8Single:      ; db        "S8 ",NULL
     89                                ; db         53h,  38h,  20h,  00h    ; uncompressed
     90                                  db         59h,  31h,  00h          ; compressed
     91
     92g_szBusTypeValues_16:           ; db        " 16",NULL
     93                                ; db         20h,  31h,  36h,  00h    ; uncompressed
     94                                  db         20h,  2bh,  10h          ; compressed
     95
     96g_szBusTypeValues_32:           ; db        " 32",NULL
     97                                ; db         20h,  33h,  32h,  00h    ; uncompressed
     98                                  db         20h,  2dh,  0ch          ; compressed
     99
     100g_szBusTypeValues_Serial:       ; db        "SER",NULL
     101                                ; db         53h,  45h,  52h,  00h    ; uncompressed
     102                                  db         59h,  4bh,  98h          ; compressed
     103
     104g_szBusTypeValues_Displacement equ (g_szBusTypeValues_8Reversed - g_szBusTypeValues)
     105;
     106; Ensure that bus type strings are correctly spaced in memory
     107;
     108%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
     109%if g_szBusTypeValues_8Dual <> g_szBusTypeValues
     110%error "g_szBusTypeValues Displacement Incorrect 1"
     111%endif
     112%if g_szBusTypeValues_8Reversed <> g_szBusTypeValues + g_szBusTypeValues_Displacement
     113%error "g_szBusTypeValues Displacement Incorrect 2"
     114%endif
     115%if g_szBusTypeValues_8Single <> g_szBusTypeValues_8Reversed + g_szBusTypeValues_Displacement
     116%error "g_szBusTypeValues Displacement Incorrect 3"
     117%endif
     118%if g_szBusTypeValues_16 <> g_szBusTypeValues_8Single + g_szBusTypeValues_Displacement
     119%error "g_szBusTypeValues Displacement Incorrect 4"
     120%endif
     121%if g_szBusTypeValues_32 <> g_szBusTypeValues_16 + g_szBusTypeValues_Displacement
     122%error "g_szBusTypeValues Displacement Incorrect 5"
     123%endif
     124%if g_szBusTypeValues_Serial <> g_szBusTypeValues_32 + g_szBusTypeValues_Displacement
     125%error "g_szBusTypeValues Displacement Incorrect 6"
     126%endif
     127%endif
     128
     129g_szSelectionTimeout:   ; db        DOUBLE_BOTTOM_LEFT_CORNER,DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL,"%ASelection in %2-u s",NULL
     130                        ; db        0c8h, 0b5h,  25h,  41h,  53h,  65h,  6ch,  65h,  63h,  74h,  69h,  6fh,  6eh,  20h,  69h,  6eh,  20h,  25h,  32h,  2dh,  75h,  20h,  73h,  00h    ; uncompressed
     131                          db         32h,  33h,  3dh,  59h,  6bh,  72h,  6bh,  69h,  7ah,  6fh,  75h, 0f4h,  6fh, 0f4h,  3ch,  20h, 0b9h                                              ; compressed
     132
     133
     134g_szDashForZero:        ; db        "- ",NULL
     135                        ; db         2dh,  20h,  00h    ; uncompressed
     136                          db         28h,  00h          ; compressed
     137
     138
     139; Boot Menu Floppy Disk strings
     140;
     141; The following strings are used by BootMenuPrint_RefreshInformation
     142; To support optimizations in that code, these strings must start on the same 256 byte page,
     143; which is checked at assembly time below.
     144;
     145g_szFddStart:
     146g_szFddUnknown: ; db    "Unknown",NULL
     147                ; db     55h,  6eh,  6bh,  6eh,  6fh,  77h,  6eh,  00h    ; uncompressed
     148                  db     5bh,  74h,  71h,  74h,  75h,  7dh, 0b4h          ; compressed
     149
     150g_szFddSizeOr:  ; db    "5",ONE_QUARTER,QUOTATION_MARK," or 3",ONE_HALF,QUOTATION_MARK," DD",NULL
     151                ; db     35h, 0ach,  22h,  20h,  6fh,  72h,  20h,  33h, 0abh,  22h,  20h,  44h,  44h,  00h    ; uncompressed
     152                  db     2fh,  21h,  26h,  20h,  75h, 0f8h,  2dh,  22h,  26h,  20h,  4ah,  8ah                ; compressed
     153
     154g_szFddSize:    ; db    "%s",QUOTATION_MARK,", %u kiB",NULL ; 3½", 1440 kiB
     155                ; db     25h,  73h,  22h,  2ch,  20h,  25h,  75h,  20h,  6bh,  69h,  42h,  00h    ; uncompressed
     156                  db     3eh,  26h,  27h,  20h,  37h,  20h,  71h,  6fh,  88h                      ; compressed
     157
     158g_szFddThreeHalf:       ; db  "3",ONE_HALF,NULL
     159                        ; db   33h, 0abh,  00h    ; uncompressed
     160                          db   2dh,  02h          ; compressed
     161
     162g_szFddEnd:
     163g_szFddFiveQuarter:     ; db  "5",ONE_QUARTER,NULL
     164                        ; db   35h, 0ach,  00h    ; uncompressed
     165                          db   2fh,  01h          ; compressed
     166
     167
     168%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
     169%if ((g_szFddStart-$$) & 0xff00) <> ((g_szFddEnd-$$) & 0xff00)
     170%error "g_szFdd* strings must start on the same 256 byte page, required by the BootMenuPrint_RefreshInformation routines for floppy drives.  Please move this block up or down within strings.asm"
     171%endif
     172%endif
     173
    19174; The following strings are used by DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP
    20175; To support an optimization in that code, these strings must start on the same 256 byte page,
     
    34189                          db     4fh,  4ah, 0cbh,  3eh,  20h,  67h, 0fah,  3eh,  40h,  00h                                  ; compressed
    35190
    36 g_szDetectOuterSerial:  ; db    "Serial %s on %s: ",NULL       
     191%ifdef MODULE_SERIAL        ;%%; is stripped off after string compression, %ifdef won't compress properly
     192g_szDetectOuterSerial:  ; db    "Serial %s on %s: ",NULL
    37193                        ; db     53h,  65h,  72h,  69h,  61h,  6ch,  20h,  25h,  73h,  20h,  6fh,  6eh,  20h,  25h,  73h,  3ah,  20h,  00h    ; uncompressed
    38194                          db     59h,  6bh,  78h,  6fh,  67h, 0f2h,  3eh,  20h,  75h, 0f4h,  3eh,  40h,  00h                                  ; compressed
    39195
     196g_szDetectCOM:          ; db  "COM%c%s",NULL
     197                        ; db   43h,  4fh,  4dh,  25h,  63h,  25h,  73h,  00h    ; uncompressed
     198                          db   49h,  55h,  53h,  35h,  1eh                      ; compressed
     199
     200g_szDetectCOMAuto:      ; db    " Detect",NULL
     201                        ; db     20h,  44h,  65h,  74h,  65h,  63h,  74h,  00h    ; uncompressed
     202                          db     20h,  4ah,  6bh,  7ah,  6bh,  69h, 0bah          ; compressed
     203
     204g_szDetectCOMSmall:     ; db    "/%u%u00",NULL                  ; IDE Master at COM1/9600:
     205                        ; db     2fh,  25h,  75h,  25h,  75h,  30h,  30h,  00h    ; uncompressed
     206                          db     2ah,  37h,  37h,  34h,  14h                      ; compressed
     207
     208g_szDetectCOMLarge:     ; db    "/%u.%uK",NULL                  ; IDE Master at COM1/19.2K:
     209                        ; db     2fh,  25h,  75h,  2eh,  25h,  75h,  4bh,  00h    ; uncompressed
     210                          db     2ah,  37h,  29h,  37h,  91h                      ; compressed
     211
     212%endif                      ;%%; is stripped off after string compression, %ifdef won't compress properly
     213g_szDetectEnd:
    40214g_szDetectPort:         ; db    "%x",NULL                       ; IDE Master at 1F0h:
    41215                        ; db     25h,  78h,  00h    ; uncompressed
    42216                          db     19h                ; compressed
    43 
    44 g_szDetectCOM:          ; db  "COM%c%s",NULL
    45                         ; db   43h,  4fh,  4dh,  25h,  63h,  25h,  73h,  00h    ; uncompressed
    46                           db   49h,  55h,  53h,  35h,  1eh                      ; compressed
    47 
    48 g_szDetectCOMAuto:      ; db    " Detect",NULL
    49                         ; db     20h,  44h,  65h,  74h,  65h,  63h,  74h,  00h    ; uncompressed
    50                           db     20h,  4ah,  6bh,  7ah,  6bh,  69h, 0bah          ; compressed
    51 
    52 g_szDetectCOMSmall:     ; db    "/%u%u00",NULL                  ; IDE Master at COM1/9600:
    53                         ; db     2fh,  25h,  75h,  25h,  75h,  30h,  30h,  00h    ; uncompressed
    54                           db     2ah,  37h,  37h,  34h,  14h                      ; compressed
    55 
    56 g_szDetectEnd:
    57 g_szDetectCOMLarge:     ; db    "/%u.%uK",NULL                  ; IDE Master at COM1/19.2K:
    58                         ; db     2fh,  25h,  75h,  2eh,  25h,  75h,  4bh,  00h    ; uncompressed
    59                           db     2ah,  37h,  29h,  37h,  91h                      ; compressed
    60217
    61218
     
    97254%endif
    98255
    99 ; POST drive detection strings
    100 g_szRomAt:      ; db    "%s @ %x",LF,CR,NULL
    101                 ; db     25h,  73h,  20h,  40h,  20h,  25h,  78h,  0ah,  0dh,  00h    ; uncompressed
    102                   db     3eh,  20h, 0c6h,  39h,  1bh                                  ; compressed
    103 
    104 
    105 ; Boot loader strings
    106 g_szTryToBoot:          ; db    "Booting from %s %x",ANGLE_QUOTE_RIGHT,"%x",LF,CR,NULL
    107                         ; 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
    108                           db     48h,  75h,  75h,  7ah,  6fh,  74h, 0edh,  6ch,  78h,  75h, 0f3h,  3eh,  20h,  39h,  24h,  39h,  1bh                                              ; compressed
    109 
    110 g_szBootSectorNotFound: ; db    "Boot sector "
    111                         ; db     42h,  6fh,  6fh,  74h,  20h,  73h,  65h,  63h,  74h,  6fh,  72h,  20h    ; uncompressed
    112                           db     48h,  75h,  75h, 0fah,  79h,  6bh,  69h,  7ah,  75h, 0f8h                ; compressed
    113 
    114 g_szNotFound:           ; db    "not found",LF,CR,NULL
    115                         ; db     6eh,  6fh,  74h,  20h,  66h,  6fh,  75h,  6eh,  64h,  0ah,  0dh,  00h    ; uncompressed
    116                           db     74h,  75h, 0fah,  6ch,  75h,  7bh,  74h,  6ah,  1bh                      ; compressed
    117 
    118 g_szReadError:          ; db    "Error %x!",LF,CR,NULL
    119                         ; db     45h,  72h,  72h,  6fh,  72h,  20h,  25h,  78h,  21h,  0ah,  0dh,  00h    ; uncompressed
    120                           db     4bh,  78h,  78h,  75h, 0f8h,  39h,  25h,  1bh                            ; compressed
    121 
    122 
    123256; Boot menu bottom of screen strings
    124257g_szFDD:        ; db    "FDD     ",NULL
     
    160293      db        3eh,  23h,  38h,  23h,  3eh,  23h,  20h,  36h,  23h,  1ah                                                                            ; compressed
    161294
    162 
    163 g_szAddressingModes:
    164 g_szLCHS:       ; db    "L-CHS",NULL
    165                 ; db     4ch,  2dh,  43h,  48h,  53h,  00h    ; uncompressed
    166                   db     52h,  28h,  49h,  4eh,  99h          ; compressed
    167 
    168 g_szPCHS:       ; db    "P-CHS",NULL
    169                 ; db     50h,  2dh,  43h,  48h,  53h,  00h    ; uncompressed
    170                   db     56h,  28h,  49h,  4eh,  99h          ; compressed
    171 
    172 g_szLBA28:      ; db    "LBA28",NULL
    173                 ; db     4ch,  42h,  41h,  32h,  38h,  00h    ; uncompressed
    174                   db     52h,  48h,  47h,  2ch,  11h          ; compressed
    175 
    176 g_szLBA48:      ; db    "LBA48",NULL
    177                 ; db     4ch,  42h,  41h,  34h,  38h,  00h    ; uncompressed
    178                   db     52h,  48h,  47h,  2eh,  11h          ; compressed
    179 
    180 g_szAddressingModes_Displacement equ (g_szPCHS - g_szAddressingModes)
    181 ;
    182 ; Ensure that addressing modes are correctly spaced in memory
    183 ;
    184 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
    185 %if g_szLCHS <> g_szAddressingModes
    186 %error "g_szAddressingModes Displacement Incorrect 1"
    187 %endif
    188 %if g_szPCHS <> g_szLCHS + g_szAddressingModes_Displacement
    189 %error "g_szAddressingModes Displacement Incorrect 2"
    190 %endif
    191 %if g_szLBA28 <> g_szPCHS + g_szAddressingModes_Displacement
    192 %error "g_szAddressingModes Displacement Incorrect 3"
    193 %endif
    194 %if g_szLBA48 <> g_szLBA28 + g_szAddressingModes_Displacement
    195 %error "g_szAddressingModes Displacement Incorrect 4"
    196 %endif
    197 %endif
    198 
    199 g_szBusTypeValues:
    200 g_szBusTypeValues_8Dual:        ; db        "D8 ",NULL
    201                                 ; db         44h,  38h,  20h,  00h    ; uncompressed
    202                                   db         4ah,  31h,  00h          ; compressed
    203 
    204 g_szBusTypeValues_8Reversed:    ; db        "X8 ",NULL
    205                                 ; db         58h,  38h,  20h,  00h    ; uncompressed
    206                                   db         5eh,  31h,  00h          ; compressed
    207 
    208 g_szBusTypeValues_8Single:      ; db        "S8 ",NULL
    209                                 ; db         53h,  38h,  20h,  00h    ; uncompressed
    210                                   db         59h,  31h,  00h          ; compressed
    211 
    212 g_szBusTypeValues_16:           ; db        " 16",NULL
    213                                 ; db         20h,  31h,  36h,  00h    ; uncompressed
    214                                   db         20h,  2bh,  10h          ; compressed
    215 
    216 g_szBusTypeValues_32:           ; db        " 32",NULL
    217                                 ; db         20h,  33h,  32h,  00h    ; uncompressed
    218                                   db         20h,  2dh,  0ch          ; compressed
    219 
    220 g_szBusTypeValues_Serial:       ; db        "SER",NULL
    221                                 ; db         53h,  45h,  52h,  00h    ; uncompressed
    222                                   db         59h,  4bh,  98h          ; compressed
    223 
    224 g_szBusTypeValues_Displacement equ (g_szBusTypeValues_8Reversed - g_szBusTypeValues)
    225 ;
    226 ; Ensure that bus type strings are correctly spaced in memory
    227 ;
    228 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
    229 %if g_szBusTypeValues_8Dual <> g_szBusTypeValues
    230 %error "g_szBusTypeValues Displacement Incorrect 1"
    231 %endif
    232 %if g_szBusTypeValues_8Reversed <> g_szBusTypeValues + g_szBusTypeValues_Displacement
    233 %error "g_szBusTypeValues Displacement Incorrect 2"
    234 %endif
    235 %if g_szBusTypeValues_8Single <> g_szBusTypeValues_8Reversed + g_szBusTypeValues_Displacement
    236 %error "g_szBusTypeValues Displacement Incorrect 3"
    237 %endif
    238 %if g_szBusTypeValues_16 <> g_szBusTypeValues_8Single + g_szBusTypeValues_Displacement
    239 %error "g_szBusTypeValues Displacement Incorrect 4"
    240 %endif
    241 %if g_szBusTypeValues_32 <> g_szBusTypeValues_16 + g_szBusTypeValues_Displacement
    242 %error "g_szBusTypeValues Displacement Incorrect 5"
    243 %endif
    244 %if g_szBusTypeValues_Serial <> g_szBusTypeValues_32 + g_szBusTypeValues_Displacement
    245 %error "g_szBusTypeValues Displacement Incorrect 6"
    246 %endif
    247 %endif
    248 
    249 g_szSelectionTimeout:   ; db        DOUBLE_BOTTOM_LEFT_CORNER,DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL,"%ASelection in %2-u s",NULL
    250                         ; db        0c8h, 0b5h,  25h,  41h,  53h,  65h,  6ch,  65h,  63h,  74h,  69h,  6fh,  6eh,  20h,  69h,  6eh,  20h,  25h,  32h,  2dh,  75h,  20h,  73h,  00h    ; uncompressed
    251                           db         32h,  33h,  3dh,  59h,  6bh,  72h,  6bh,  69h,  7ah,  6fh,  75h, 0f4h,  6fh, 0f4h,  3ch,  20h, 0b9h                                              ; compressed
    252 
    253 
    254 g_szDashForZero:        ; db        "- ",NULL
    255                         ; db         2dh,  20h,  00h    ; uncompressed
    256                           db         28h,  00h          ; compressed
    257 
    258 
    259 ; Boot Menu Floppy Disk strings
    260 ;
    261 ; The following strings are used by BootMenuPrint_RefreshInformation
    262 ; To support optimizations in that code, these strings must start on the same 256 byte page,
    263 ; which is checked at assembly time below.
    264 ;
    265 g_szFddStart:
    266 g_szFddUnknown: ; db    "Unknown",NULL
    267                 ; db     55h,  6eh,  6bh,  6eh,  6fh,  77h,  6eh,  00h    ; uncompressed
    268                   db     5bh,  74h,  71h,  74h,  75h,  7dh, 0b4h          ; compressed
    269 
    270 g_szFddSizeOr:  ; db    "5",ONE_QUARTER,QUOTATION_MARK," or 3",ONE_HALF,QUOTATION_MARK," DD",NULL
    271                 ; db     35h, 0ach,  22h,  20h,  6fh,  72h,  20h,  33h, 0abh,  22h,  20h,  44h,  44h,  00h    ; uncompressed
    272                   db     2fh,  21h,  26h,  20h,  75h, 0f8h,  2dh,  22h,  26h,  20h,  4ah,  8ah                ; compressed
    273 
    274 g_szFddSize:    ; db    "%s",QUOTATION_MARK,", %u kiB",NULL ; 3½", 1440 kiB
    275                 ; db     25h,  73h,  22h,  2ch,  20h,  25h,  75h,  20h,  6bh,  69h,  42h,  00h    ; uncompressed
    276                   db     3eh,  26h,  27h,  20h,  37h,  20h,  71h,  6fh,  88h                      ; compressed
    277 
    278 g_szFddThreeHalf:       ; db  "3",ONE_HALF,NULL
    279                         ; db   33h, 0abh,  00h    ; uncompressed
    280                           db   2dh,  02h          ; compressed
    281 
    282 g_szFddEnd:
    283 g_szFddFiveQuarter:     ; db  "5",ONE_QUARTER,NULL
    284                         ; db   35h, 0ach,  00h    ; uncompressed
    285                           db   2fh,  01h          ; compressed
    286 
    287 
    288 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
    289 %if ((g_szFddStart-$$) & 0xff00) <> ((g_szFddEnd-$$) & 0xff00)
    290 %error "g_szFdd* strings must start on the same 256 byte page, required by the BootMenuPrint_RefreshInformation routines for floppy drives.  Please move this block up or down within strings.asm"
    291 %endif
    292 %endif
    293295
    294296;------------------------------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm

    r271 r277  
    4343;
    4444    call    RamVars_UnpackFlopCntAndFirstToAL
    45     cbw                                         ; normally 0h, could be ffh if no drives present
    46     adc     ah, al                              ; if no drives present, still ffh (ffh + ffh + 1 = ffh)
    4745    js      SHORT .DiskIsNotHandledByThisBIOS
     46               
     47    cbw                                         ; Always 0h (no floppy drive covered above)
     48    adc     ah, al                              ; Add in first drive number and number of drives
     49
    4850    cmp     ah, dl                              ; Check second drive if two, first drive if only one
    4951    jz      SHORT .CalcDPTForDriveNumber
  • trunk/XTIDE_Universal_BIOS/makefile

    r272 r277  
    6060LIBS += ../Assembly_Library/Src/Time/
    6161LIBS += ../Assembly_Library/Src/Util/
     62LIBS += ../Assembly_Library/Src/Serial/
    6263LIBS += ../XTIDE_Universal_BIOS/Inc/
    6364HEADERS += $(LIBS)
     
    164165    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -l"$(TARGET)_xtl.lst" -o"$(TARGET)_xtl.bin"
    165166    @echo *15k XT version "$(TARGET)_xtl.bin" built.
    166    
     167
    167168jride_8k:
    168169    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_JRIDE_8K) -l"$(TARGET)_jr8k.lst" -o"$(TARGET)_jr8k.bin"
     
    185186
    186187src\StringsCompressed.asm: src\Strings.asm
    187     @$(AS) src\Strings.asm $(ASFLAGS) $(DEFS_XT) -DMODULE_STRINGS_COMPRESSED_PRECOMPRESS -o build\Strings.bin -l build\StringsPrecompress.lst
     188    @$(AS) src\Strings.asm $(ASFLAGS) $(DEFS_XT) -DCHECK_FOR_UNUSED_ENTRYPOINTS -DMODULE_STRINGS_COMPRESSED_PRECOMPRESS -o build\Strings.bin -l build\StringsPrecompress.lst
    188189    @perl ..\tools\StringsCompress.pl < build\StringsPrecompress.lst > src\StringsCompressed.asm
    189190    @echo StringsCompressed.asm updated!
Note: See TracChangeset for help on using the changeset viewer.