Changeset 277 in xtideuniversalbios
- Timestamp:
- Feb 28, 2012, 2:45:48 PM (13 years ago)
- google:author:
- gregli@hotmail.com
- Location:
- trunk
- Files:
-
- 5 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Assembly_Library/Src/AssemblyLibrary.asm
r256 r277 68 68 %endif 69 69 70 %ifdef INCLUDE_SERIAL_LIBRARY 71 %include "Serial.inc" 72 %endif 73 %ifdef INCLUDE_SERIALSERVER_LIBRARY 74 %include "SerialServer.asm" 75 %include "SerialServerScan.asm" 76 %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS 77 %include "SerialServerImage.asm" 78 %endif 79 %define INCLUDE_TIME_LIBRARY 80 %endif 81 70 82 %ifdef INCLUDE_TIME_LIBRARY 71 83 %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS … … 89 101 %endif 90 102 %endif 103 -
trunk/Serial_Server/library/Image.cpp
r259 r277 38 38 39 39 return( fi ); 40 } 41 42 void flipEndian( unsigned short *buff, unsigned int len ) 43 { 44 for( unsigned int t = 0; t < len/2; t++ ) 45 buff[t] = (buff[t] & 0xff) << 8 | (buff[t] & 0xff00) >> 8; 40 46 } 41 47 … … 178 184 #define ATA_wBpSect 5 179 185 #define ATA_wSPT 6 186 180 187 #define ATA_strSerial 10 188 #define ATA_strSerial_Length 20 189 181 190 #define ATA_strFirmware 23 191 #define ATA_strFirmware_Length 8 192 182 193 #define ATA_strModel 27 194 #define ATA_strModel_Length 40 195 183 196 #define ATA_wCaps 49 184 197 #define ATA_wCurCyls 54 … … 190 203 // Words carved out of the vendor specific area for our use 191 204 // 205 #define ATA_wSerialServerVersion 157 192 206 #define ATA_wSerialFloppyFlagAndType 158 193 207 #define ATA_wSerialPortAndBaud 159 … … 223 237 }; 224 238 225 void Image::respondInquire( unsigned short *buff, struct baudRate *baudRate, unsigned short port, unsigned char scan ) 226 { 239 void Image::respondInquire( unsigned short *buff, unsigned short originalPortAndBaud, struct baudRate *baudRate, unsigned short port, unsigned char scan ) 240 { 241 char formatBuff[ 128 ]; 242 227 243 memset( &buff[0], 0, 514 ); 228 244 … … 240 256 241 257 if( comPort ) 242 sprintf( (char *) &buff[ATA_strModel], "%.15s (COM%c/%s)", shortFileName, comPort, baudRate->display );258 sprintf( formatBuff, "%.15s (COM%c/%s) ", shortFileName, comPort, baudRate->display ); 243 259 else 244 sprintf( (char *) &buff[ATA_strModel], "%.25s (%s baud)", shortFileName, baudRate->display );260 sprintf( formatBuff, "%.25s (%s baud) ", shortFileName, baudRate->display ); 245 261 } 246 262 else 247 sprintf( (char *) &buff[ATA_strModel], "%.30s", shortFileName ); 248 249 strncpy( (char *) &buff[ATA_strSerial], "serial", 20 ); 250 strncpy( (char *) &buff[ATA_strFirmware], "firmw", 8 ); 251 252 for( int t = ATA_strModel; t < ATA_strModel+40; t++ ) 253 buff[t] = (buff[t] >> 8) | (buff[t] << 8); 263 sprintf( formatBuff, "%.30s ", shortFileName ); 264 strncpy( (char *) &buff[ATA_strModel], formatBuff, ATA_strModel_Length ); 265 flipEndian( &buff[ATA_strModel], ATA_strModel_Length ); 266 267 strncpy( (char *) &buff[ATA_strSerial], "SerialDrive ", ATA_strSerial_Length ); 268 flipEndian( &buff[ATA_strSerial], ATA_strSerial_Length ); 269 270 sprintf( formatBuff, "%d.%d ", SERIAL_SERVER_MAJORVERSION, SERIAL_SERVER_MINORVERSION ); 271 strncpy( (char *) &buff[ATA_strFirmware], formatBuff, ATA_strFirmware_Length ); 272 flipEndian( &buff[ATA_strFirmware], ATA_strFirmware_Length ); 254 273 255 274 if( useCHS ) … … 266 285 } 267 286 287 // We echo back the port and baud that we were called on from the client, 288 // the client then uses this value to finalize the DPT. 289 // 290 buff[ ATA_wSerialPortAndBaud ] = originalPortAndBaud; 291 292 // In case the client requires a specific server version... 293 // 294 buff[ ATA_wSerialServerVersion ] = (SERIAL_SERVER_MAJORVERSION << 8) | SERIAL_SERVER_MINORVERSION; 295 268 296 if( floppy ) 269 buff[ ATA_wSerialFloppyFlagAndType ] = ATA_wSerialFloppyFlagAndType_Flag | (floppyType << ATA_wSerialFloppyFlagAndType_TypePosition); 297 buff[ ATA_wSerialFloppyFlagAndType ] = 298 ATA_wSerialFloppyFlagAndType_Flag | (floppyType << ATA_wSerialFloppyFlagAndType_TypePosition); 270 299 271 300 // we always set this, so that the bulk of the BIOS will consider this disk as a hard disk -
trunk/Serial_Server/library/Library.h
r259 r277 8 8 #ifndef LIBRARY_H_INCLUDED 9 9 #define LIBRARY_H_INCLUDED 10 11 #define SERIAL_SERVER_MAJORVERSION 1 12 #define SERIAL_SERVER_MINORVERSION 0 10 13 11 14 void log( int level, char *message, ... ); … … 54 57 static int parseGeometry( char *str, unsigned long *p_cyl, unsigned long *p_head, unsigned long *p_sect ); 55 58 56 void respondInquire( unsigned short *buff, struct baudRate *baudRate, unsigned short port, unsigned char scan );59 void respondInquire( unsigned short *buff, unsigned short originalPortAndBaud, struct baudRate *baudRate, unsigned short port, unsigned char scan ); 57 60 58 61 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
r258 r277 35 35 unsigned char baud; 36 36 } inquire; 37 struct { 38 unsigned char command; 39 unsigned char driveAndHead; 40 unsigned char count; 41 unsigned char scan; 42 unsigned short PackedPortAndBaud; 43 } inquirePacked; 37 44 unsigned char b[514]; 38 45 unsigned short w[257]; … … 342 349 localScan = buff.inquire.scan; // need to do this before the call to 343 350 // img->respondInquire, as it will clear the buff 344 img->respondInquire( &buff.w[0], serial->baudRate, 351 img->respondInquire( &buff.w[0], buff.inquirePacked.PackedPortAndBaud, 352 serial->baudRate, 345 353 ((unsigned short) buff.inquire.port) << 2, 346 354 (img == image1 && lastScan) || buff.inquire.scan ); -
trunk/Tools/StringsCompress.pl
r242 r277 159 159 160 160 # 161 # a ';%%;' prefix line, copy to output without the prefix 162 # 163 elsif( /^\s*\d+\s*;%%;\s*(.*)$/ ) 164 { 165 print $1."\n"; 166 } 167 168 # 161 169 # everything else, copy to the output as is 162 170 # -
trunk/XTIDE_Universal_BIOS/Inc/ATA_ID.inc
r258 r277 254 254 .wRMSN resw 1 ; 127F, Removable Media Status Notification feature set support 255 255 .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 261 257 .wCFAPower resw 1 ; 160FV, CFA Power Mode 1 262 258 resw 176-161 ; 161...175R, Reserved for assignment by the CompactFlash Association -
trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc
r276 r277 118 118 ENABLE_WRITE_CACHE EQU 2 119 119 120 121 122 ;123 ; COM Number to I/O Port Address Mapping124 ;125 ; COM Number: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12126 ; Corresponds to I/O port: 3f8, 2f8, 3e8, 2e8, 2f0, 3e0, 2e0, 260, 368, 268, 360, 270127 ; Corresponds to Packed I/O port (hex): 37, 17, 35, 15, 16, 34, 14, 4, 25, 5, 24, 6128 ;129 DEVICE_SERIAL_COM1 EQU 3f8h130 DEVICE_SERIAL_COM2 EQU 2f8h131 DEVICE_SERIAL_COM3 EQU 3e8h132 DEVICE_SERIAL_COM4 EQU 2e8h133 DEVICE_SERIAL_COM5 EQU 2f0h134 DEVICE_SERIAL_COM6 EQU 3e0h135 DEVICE_SERIAL_COM7 EQU 2e0h136 DEVICE_SERIAL_COM8 EQU 260h137 DEVICE_SERIAL_COM9 EQU 368h138 DEVICE_SERIAL_COMA EQU 268h139 DEVICE_SERIAL_COMB EQU 360h140 DEVICE_SERIAL_COMC EQU 270h141 142 143 120 %endif ; ROMVARS_INC -
trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm
r262 r277 4 4 ; Section containing code 5 5 SECTION .text 6 7 ;--------------- UART Equates -----------------------------8 ;9 ; Serial Programming References:10 ; http://en.wikibooks.org/wiki/Serial_Programming11 ;12 13 SerialCommand_UART_base EQU 014 SerialCommand_UART_transmitByte EQU 015 SerialCommand_UART_receiveByte EQU 016 17 ;18 ; Values for UART_divisorLow:19 ; 60h = 1200, 30h = 2400, 18h = 4800, 0ch = 9600, 6 = 19200, 4 = 28800, 3 = 38400, 2 = 57600, 1 = 11520020 ;21 SerialCommand_UART_divisorLow EQU 022 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 127 28 SerialCommand_UART_interruptIdent EQU 229 SerialCommand_UART_FIFOControl EQU 230 31 SerialCommand_UART_lineControl EQU 332 33 SerialCommand_UART_modemControl EQU 434 35 SerialCommand_UART_lineStatus EQU 536 37 SerialCommand_UART_modemStatus EQU 638 39 SerialCommand_UART_scratch EQU 740 41 SerialCommand_Protocol_Write EQU 342 SerialCommand_Protocol_Read EQU 243 SerialCommand_Protocol_Inquire EQU 044 SerialCommand_Protocol_Header EQU 0a0h45 6 46 7 ;-------------------------------------------------------------------- … … 64 25 SerialCommand_OutputWithParameters: 65 26 66 mov ah, (SerialCommand_Protocol_Header | SerialCommand_Protocol_Read)27 mov ah,SerialServer_Command_Read 67 28 68 29 mov al,[bp+IDEPACK.bCommand] … … 70 31 cmp al,20h ; Read Sectors IDE command 71 32 jz .readOrWrite 72 inc ah ; now Serial Command_Protocol_Write33 inc ah ; now SerialServer_Protocol_Write 73 34 cmp al,30h ; Write Sectors IDE command 74 35 jz .readOrWrite … … 85 46 mov dx, [di+DPT_SERIAL.wSerialPortAndBaud] 86 47 87 ; fall-through 48 jmp SerialServer_SendReceive 88 49 89 ;--------------------------------------------------------------------90 ; SerialCommand_OutputWithParameters_DeviceInDX91 ; Parameters:92 ; AH: Protocol Command93 ; DX: Packed I/O port and baud rate94 ; ES:SI: Ptr to buffer (for data transfer commands)95 ; SS:BP: Ptr to IDEREGS_AND_INTPACK96 ; Returns:97 ; AH: INT 13h Error Code98 ; CF: Cleared if success, Set if error99 ; Corrupts registers:100 ; AL, BX, CX, DX, (ES:SI for data transfer commands)101 ;--------------------------------------------------------------------102 SerialCommand_OutputWithParameters_DeviceInDX:103 104 push si105 push di106 push bp107 108 ;109 ; Unpack I/O port and baud from DPT110 ; Port to DX for the remainder of the routine (+/- different register offsets)111 ; Baud in CH until UART initialization is complete112 ;113 mov ch,dh114 xor dh,dh115 eSHL_IM dx, 2 ; shift from one byte to two116 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 access121 ;122 push ax123 124 %if 0125 cld ; Shouldn't be needed. DF has already been cleared (line 24, Int13h.asm)126 %endif127 128 ;----------------------------------------------------------------------129 ;130 ; Initialize UART131 ;132 ; We do this each time since DOS (at boot) or another program may have133 ; decided to reprogram the UART134 ;135 mov bl,dl ; setup BL with proper values for read/write loops (BH comes later)136 137 mov al,83h138 add dl,SerialCommand_UART_lineControl139 out dx,al140 141 mov al,ch142 mov dl,bl ; divisor low143 out dx,al144 145 xor ax,ax146 inc dx ; divisor high147 push dx148 out dx,al149 150 mov al,047h151 inc dx ; fifo152 out dx,al153 154 mov al,03h155 inc dx ; linecontrol156 out dx,al157 158 mov al,0bh159 inc dx ; modemcontrol160 out dx,al161 162 inc dx ; linestatus (no output now, just setting up BH for later use)163 mov bh,dl164 165 pop dx ; base, interrupts disabled166 xor ax,ax167 out dx,al168 169 ;----------------------------------------------------------------------170 ;171 ; Send Command172 ;173 ; Sends first six bytes of IDEREGS_AND_INTPACK as the command174 ;175 push es ; save off real buffer location176 push si177 178 mov si,bp ; point to IDEREGS for command dispatch;179 push ss180 pop es181 182 mov di,0ffffh ; initialize checksum for write183 mov bp,di184 185 mov cx,4 ; writing 3 words (plus 1)186 187 cli ; interrupts off...188 189 call SerialCommand_WriteProtocol.entry190 191 pop di ; restore real buffer location (note change from SI to DI)192 ; Buffer is primarily referenced through ES:DI throughout, since193 ; we need to store (read sector) faster than we read (write sector)194 pop es195 196 %if 0197 ;;; no longer needed, since the pointer is normalized before we are called and we do not support198 ;;; 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_NormalizeESDI202 %endif203 204 pop ax ; load command byte (done before call to .nextSector on subsequent iterations)205 push ax206 207 ;208 ; Top of the read/write loop, one iteration per sector209 ;210 .nextSector:211 mov si,0ffffh ; initialize checksum for read or write212 mov bp,si213 214 mov cx,0101h ; writing 256 words (plus 1)215 216 shr ah,1 ; command byte, are we doing a write?217 jnc .readEntry218 219 xchg si,di220 call SerialCommand_WriteProtocol.entry221 xchg si,di222 223 inc cx ; CX = 1 now (0 out of WriteProtocol)224 jmp .readEntry225 226 ;----------------------------------------------------------------------227 ;228 ; Timeout229 ;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 also234 ; means the stack has the same number of bytes on it as when we are235 ; sending a packet, important for error cleanup and exit236 mov ah,1237 call SerialCommand_WaitAndPoll_Read238 pop ax239 test dl,1240 jz .readByte1Ready241 jmp .readByte2Ready242 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 instruction248 ; cannot be inserted into this loop without us falling behind at high249 ; speed (460.8K baud) on a 4.77Mhz 8088, making it hard to receive250 ; a full 512 byte block.251 ;252 .readLoop:253 stosw ; store word in caller's data buffer254 255 add bp, ax ; update Fletcher's checksum256 adc bp, 0257 add si, bp258 adc si, 0259 260 .readEntry:261 mov dl,bh262 in al,dx263 shr al,1 ; data ready (byte 1)?264 mov dl,bl ; get ready to read data265 jnc .readTimeout ; nope not ready, update timeouts266 267 ;268 ; Entry point after initial timeout. We enter here so that the checksum word269 ; is not stored (and is left in AX after the loop is complete).270 ;271 .readByte1Ready:272 in al, dx ; read data byte 1273 274 mov ah, al ; store byte in ah for now275 276 ;277 ; note the placement of this reset of dl to bh, and that it is278 ; before the return, which is assymetric with where this is done279 ; above for byte 1. The value of dl is used by the timeout routine280 ; to know which byte to return to (.read_byte1_ready or281 ; .read_byte2_ready)282 ;283 mov dl,bh284 285 in al,dx286 shr al,1 ; data ready (byte 2)?287 jnc .readTimeout288 .readByte2Ready:289 mov dl,bl290 in al, dx ; read data byte 2291 292 xchg al, ah ; ah was holding byte 1, reverse byte order293 294 loop .readLoop295 296 sti ; interrupts back on ASAP, between packets297 298 ;299 ; Compare checksums300 ;301 xchg ax,bp302 xor ah,al303 mov cx,si304 xor cl,ch305 mov al,cl306 cmp ax,bp307 jnz SerialCommand_OutputWithParameters_Error308 309 pop ax ; sector count and command byte310 dec al ; decrement sector count311 push ax ; save312 jz SerialCommand_OutputWithParameters_ReturnCodeInAL313 314 cli ; interrupts back off for ACK byte to host315 ; (host could start sending data immediately)316 out dx,al ; ACK with next sector number317 318 %if 0319 ;;; This code is no longer needed as we do not support more than 128 sectors, and for 128 the pointer320 ;;; 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 could326 ; 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 sectors331 ; c) on transitions from 80 to 7F, a large read/write332 ; d) on transitions from 00 to FF, very, very rare case of writing 256 sectors333 ; We don't need to renormalize in this case, but it isn't worth the memory/effort to not do334 ; 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 request337 ; for more than 127 sectors. Back in the day, it appears that some BIOS could not support more than 127338 ; sectors, so that may be the practical limit for OS and application developers. The Extended BIOS339 ; function also appear to be capped at 127 sectors. So although this can support the full 256 sectors340 ; 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:020f344 ; First decrement of AL, transition from 00 to FF: renormalize to 0020:000f (unnecessary)345 ; After second packet, 0020:020f346 ; Second derement of AL, transition from FF to FE: renormalize to 0040:000f347 ; After 7f more packets, 0040:fe0f348 ; Decrement of AL, transition from 80 to 7F: renormalize to 1020:000f349 ; After 7f more packets, 1020:fe0f or 2000:000f if normalized350 ; Decrement of AL, from 1 to 0: exit351 ;352 jge short .nextSector ; OF=SF, branch for 1-7e, most common case353 ; (0 kicked out above for return success)354 355 add al,2 ; 7f-ff moves to 81-01356 ; (0-7e kicked out before we get here)357 ; 7f moves to 81 and OF=1, so OF=SF358 ; fe moves to 0 and OF=0, SF=0, so OF=SF359 ; ff moves to 1 and OF=0, SF=0, so OF=SF360 ; 80-fd moves to 82-ff and OF=0, so OF<>SF361 362 jl short .nextSector ; OF<>SF, branch for all cases but 7f, fe, and ff363 364 ; jpo short .nextSector ; if we really wanted to avoid normalizing for ff, this365 ; is one way to do it, but it adds more memory and more366 ; cycles for the 7f and fe cases. IMHO, given that I've367 ; 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 %else372 373 jmp short .nextSector374 375 %endif376 377 ;---------------------------------------------------------------------------378 ;379 ; Cleanup, error reporting, and exit380 ;381 382 ;383 ; Used in situations where a call is underway, such as with SerialCommand_WaitAndPoll384 ;385 ALIGN JUMP_ALIGN386 SerialCommand_OutputWithParameters_ErrorAndPop4Words:387 add sp,8388 ;;; fall-through389 390 ALIGN JUMP_ALIGN391 SerialCommand_OutputWithParameters_Error:392 ;----------------------------------------------------------------------393 ;394 ; Clear read buffer395 ;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 have398 ; 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 there401 .clearBuffer:402 mov dl,bh403 in al,dx404 mov dl,bl405 test al,08fh406 jz .clearBufferComplete407 test al,1408 in al,dx409 loopnz .clearBuffer ; note ZF from test above410 411 .clearBufferComplete:412 mov al, 3 ; error return code and CF (low order bit)413 414 ALIGN JUMP_ALIGN415 SerialCommand_OutputWithParameters_ReturnCodeInAL:416 %if 0417 sti ; all paths here will already have interrupts turned back on418 %endif419 mov ah, al ; for success, AL will already be zero420 421 pop bx ; recover "ax" (command and count) from stack422 423 pop bp424 pop di425 pop si426 427 mov ch, 0428 mov cl,[bp+IDEPACK.bSectorCount]429 sub cl, bl ; subtract off the number of sectors that remained430 431 shr ah, 1 ; shift down return code and CF432 433 ret434 435 ;--------------------------------------------------------------------436 ; SerialCommand_WriteProtocol437 ;438 ; NOTE: As with its read counterpart, this loop is very time sensitive.439 ; Although it will still function, adding additional instructions will440 ; impact the write throughput, especially on slower machines.441 ;442 ; Parameters:443 ; ES:SI: Ptr to buffer444 ; CX: Words to write, plus 1445 ; BP/DI: Initialized for Checksum (-1 in each)446 ; DH: I/O Port high byte447 ; 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 .readLoop450 ; CX: Zero451 ; DL: Receive/Transmit Register address452 ; Corrupts registers:453 ; AX454 ;--------------------------------------------------------------------455 ALIGN JUMP_ALIGN456 SerialCommand_WriteProtocol:457 .writeLoop:458 es lodsw ; fetch next word459 460 out dx,al ; output first byte461 462 add bp,ax ; update checksum463 adc bp,0464 add di,bp465 adc di,0466 467 mov dl,bh ; transmit buffer empty?468 in al,dx469 test al,20h470 jz .writeTimeout2 ; nope, use our polling routine471 472 .writeByte2Ready:473 mov dl,bl474 mov al,ah ; output second byte475 out dx,al476 477 .entry:478 mov dl,bh ; transmit buffer empty?479 in al,dx480 test al,20h481 mov dl,bl482 jz .writeTimeout1 ; nope, use our polling routine483 484 .writeByte1Ready:485 loop .writeLoop486 487 mov ax,di ; fold Fletcher's checksum and output488 xor al,ah489 out dx,al ; byte 1490 491 call SerialCommand_WaitAndPoll_Write492 493 mov ax,bp494 xor al,ah495 out dx,al ; byte 2496 497 ret498 499 .writeTimeout2:500 mov dl,ah ; need to preserve AH, but don't need DL (will be reset upon return)501 call SerialCommand_WaitAndPoll_Write502 mov ah,dl503 jmp .writeByte2Ready504 505 .writeTimeout1:506 %ifndef USE_186507 mov ax,.writeByte1Ready508 push ax ; return address for ret at end of SC_writeTimeout2509 %else510 push .writeByte1Ready511 %endif512 ;;; fall-through513 514 ;--------------------------------------------------------------------515 ; SerialCommand_WaitAndPoll516 ;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 write520 ; DX: Port address (OK if already incremented to UART_lineStatus)521 ; BX:522 ; Stack: 2 words on the stack below the command/count word523 ; Returns:524 ; Returns when desired UART_LineStatus bit is cleared525 ; Jumps directly to error exit if timeout elapses (and cleans up stack)526 ; Corrupts registers:527 ; AX528 ;--------------------------------------------------------------------529 530 SerialCommand_WaitAndPoll_SoftDelayTicks EQU 20531 532 ALIGN JUMP_ALIGN533 SerialCommand_WaitAndPoll_Write:534 mov ah,20h535 ;;; fall-through536 537 ALIGN JUMP_ALIGN538 SerialCommand_WaitAndPoll_Read:539 push cx540 push dx541 542 ;543 ; We first poll in a tight loop, interrupts off, for the next character to come in/be sent544 ;545 xor cx,cx546 .readTimeoutLoop:547 mov dl,bh548 in al,dx549 test al,ah550 jnz .readTimeoutComplete551 loop .readTimeoutLoop552 553 ;554 ; If that loop completes, then we assume there is a long delay involved, turn interrupts back on555 ; and wait for a given number of timer ticks to pass.556 ;557 sti558 mov cl,SerialCommand_WaitAndPoll_SoftDelayTicks559 call Timer_InitializeTimeoutWithTicksInCL560 .WaitAndPoll:561 call Timer_SetCFifTimeout562 jc SerialCommand_OutputWithParameters_ErrorAndPop4Words563 in al,dx564 test al,ah565 jz .WaitAndPoll566 cli567 568 .readTimeoutComplete:569 pop dx570 pop cx571 ret572 50 573 51 ;-------------------------------------------------------------------- … … 579 57 ; CS:BP: Ptr to IDEVARS 580 58 ; Returns: 581 ; AH: INT 13h Error Code582 ; NOTE: Not set (or checked) during drive detection583 59 ; CF: Cleared if success, Set if error 584 60 ; Corrupts registers: … … 632 108 ; master scan. 633 109 ; 634 mov cx,1 ; 1 sector to move, 0 for non-scan635 110 mov dx,[cs:bp+IDEVARS.wSerialPortAndBaud] 636 111 xor ax,ax 112 637 113 push si 638 114 call FindDPT_ToDSDIforSerialDevice … … 642 118 ; 643 119 ; 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. 644 121 ; 645 122 cmp byte [RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst], 0 … … 647 124 .founddpt: 648 125 %else 649 j nc .notfounddpt126 jc .notfounddpt 650 127 %endif 651 128 mov ax, [di+DPT_SERIAL.wSerialPortAndBaud] … … 656 133 657 134 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 taken135 jz .error 659 136 660 137 ; fall-through … … 663 140 jnz .identifyDeviceInDX 664 141 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) 668 143 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 774 146 775 147 .error: 776 148 stc 777 %if 0778 mov ah,1 ; setting the error code is unnecessary as this path can only be taken during779 ; drive detection, and drive detection works off CF and does not check AH780 %endif781 149 ret 782 783 -
trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialDPT.asm
r258 r277 17 17 ;-------------------------------------------------------------------- 18 18 SerialDPT_Finalize: 19 mov ax, [es:si+ ATA6.wSerialPortAndBaud]19 mov ax, [es:si+SerialServer_ATA_wPortAndBaud] 20 20 mov [di+DPT_SERIAL.wSerialPortAndBaud], ax 21 21 22 22 ; 23 23 ; Note that this section is not under %ifdef MODULE_SERIAL_FLOPPY. It is important to 24 ; d etect floppy disks presented by the server and not treat them likehard disks, even24 ; distinguish floppy disks presented by the server and not treat them as hard disks, even 25 25 ; if the floppy support is disabled. 26 26 ; 27 mov al, [es:si+ ATA6.wSerialFloppyFlagAndType]27 mov al, [es:si+SerialServer_ATA_wFloppyFlagAndType] 28 28 or al, FLGH_DPT_SERIAL_DEVICE 29 29 or byte [di+DPT.bFlagsHigh], al -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm
r263 r277 36 36 jz short .OurFunction ; we handle all function 0h requests (resets) 37 37 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 45 46 jns SHORT Int13h_DirectCallToAnotherBios 46 47 %endif -
trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm
r262 r277 57 57 ; on the same 256 byte page, which is checked in strings.asm. 58 58 59 %ifdef MODULE_SERIAL 59 60 cmp dh, DEVICE_SERIAL_PORT ; Check if this is a serial device 60 61 … … 95 96 96 97 .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: " 98 99 99 100 .pushAndPrint: 101 %endif 102 100 103 push cx ; Push print string 101 104 push ax ; Push high order digits, or port address, or N/A -
trunk/XTIDE_Universal_BIOS/Src/Main.asm
r276 r277 16 16 17 17 %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 18 22 19 23 ; Included .inc files -
trunk/XTIDE_Universal_BIOS/Src/Strings.asm
r262 r277 8 8 ; Section containing code 9 9 SECTION .text 10 11 ; The following strings are used by DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP12 ; 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",NULL17 g_szDetectSlave: db "Slave ",NULL18 g_szDetectOuter: db "IDE %s at %s: ",NULL19 g_szDetectOuterSerial: db "Serial %s on %s: ",NULL20 g_szDetectPort: db "%x",NULL ; IDE Master at 1F0h:21 g_szDetectCOM: db "COM%c%s",NULL22 g_szDetectCOMAuto: db " Detect",NULL23 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_ENTRYPOINTS28 %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 %endif31 %endif32 33 ; Boot Menu menuitem strings34 ;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",NULL41 g_szDriveNumBOOTNFO: db "%x %z",NULL42 g_szFloppyDrv: db "Floppy Drive %c",NULL43 g_szBootMenuPrintEnd:44 g_szForeignHD: db "Foreign Hard Disk",NULL45 46 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS47 %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 %endif50 %endif51 10 52 11 ; POST drive detection strings … … 58 17 g_szNotFound: db "not found",LF,CR,NULL 59 18 g_szReadError: db "Error %x!",LF,CR,NULL 60 61 ; Boot menu bottom of screen strings62 g_szFDD: db "FDD ",NULL63 g_szHDD: db "HDD ",NULL64 g_szRomBoot: db "ROM Boot",NULL65 g_szHotkey: db "%A%c%c%A%s%A ",NULL66 67 ; Boot Menu information strings68 g_szCapacity: db "Capacity : %s",NULL69 g_szCapacityNum: db "%5-u.%u %ciB",NULL70 g_szInformation: db "%s",LF,CR71 db "Addr.",SINGLE_VERTICAL,"Block",SINGLE_VERTICAL,"Bus",SINGLE_VERTICAL, "IRQ",SINGLE_VERTICAL,"Reset",LF,CR72 db "%s",SINGLE_VERTICAL, "%5-u",SINGLE_VERTICAL, "%s",SINGLE_VERTICAL," %2-I",SINGLE_VERTICAL,"%5-x" ,NULL73 19 74 20 g_szAddressingModes: … … 151 97 %endif 152 98 %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 ; 104 g_szDetectStart: 105 g_szDetectMaster: db "Master",NULL 106 g_szDetectSlave: db "Slave ",NULL 107 g_szDetectOuter: db "IDE %s at %s: ",NULL 108 ;%%; %ifdef MODULE_SERIAL ;%%; is stripped off after string compression, %ifdef won't compress properly 109 g_szDetectOuterSerial: db "Serial %s on %s: ",NULL 110 g_szDetectCOM: db "COM%c%s",NULL 111 g_szDetectCOMAuto: db " Detect",NULL 112 g_szDetectCOMSmall: db "/%u%u00",NULL ; IDE Master at COM1/9600: 113 g_szDetectCOMLarge: db "/%u.%uK",NULL ; IDE Master at COM1/19.2K: 114 ;%%; %endif ;%%; is stripped off after string compression, %ifdef won't compress properly 115 g_szDetectEnd: 116 g_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 ; 130 g_szBootMenuPrintStart: 131 g_szDriveNum: db "%x %s",NULL 132 g_szDriveNumBOOTNFO: db "%x %z",NULL 133 g_szFloppyDrv: db "Floppy Drive %c",NULL 134 g_szBootMenuPrintEnd: 135 g_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 144 g_szFDD: db "FDD ",NULL 145 g_szHDD: db "HDD ",NULL 146 g_szRomBoot: db "ROM Boot",NULL 147 g_szHotkey: db "%A%c%c%A%s%A ",NULL 148 149 ; Boot Menu information strings 150 g_szCapacity: db "Capacity : %s",NULL 151 g_szCapacityNum: db "%5-u.%u %ciB",NULL 152 g_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 153 155 154 156 ;------------------------------------------------------------------------------------------ -
trunk/XTIDE_Universal_BIOS/Src/StringsCompressed.asm
r262 r277 17 17 SECTION .text 18 18 19 ; POST drive detection strings 20 g_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 26 g_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 30 g_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 34 g_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 38 g_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 43 g_szAddressingModes: 44 g_szLCHS: ; db "L-CHS",NULL 45 ; db 4ch, 2dh, 43h, 48h, 53h, 00h ; uncompressed 46 db 52h, 28h, 49h, 4eh, 99h ; compressed 47 48 g_szPCHS: ; db "P-CHS",NULL 49 ; db 50h, 2dh, 43h, 48h, 53h, 00h ; uncompressed 50 db 56h, 28h, 49h, 4eh, 99h ; compressed 51 52 g_szLBA28: ; db "LBA28",NULL 53 ; db 4ch, 42h, 41h, 32h, 38h, 00h ; uncompressed 54 db 52h, 48h, 47h, 2ch, 11h ; compressed 55 56 g_szLBA48: ; db "LBA48",NULL 57 ; db 4ch, 42h, 41h, 34h, 38h, 00h ; uncompressed 58 db 52h, 48h, 47h, 2eh, 11h ; compressed 59 60 g_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 79 g_szBusTypeValues: 80 g_szBusTypeValues_8Dual: ; db "D8 ",NULL 81 ; db 44h, 38h, 20h, 00h ; uncompressed 82 db 4ah, 31h, 00h ; compressed 83 84 g_szBusTypeValues_8Reversed: ; db "X8 ",NULL 85 ; db 58h, 38h, 20h, 00h ; uncompressed 86 db 5eh, 31h, 00h ; compressed 87 88 g_szBusTypeValues_8Single: ; db "S8 ",NULL 89 ; db 53h, 38h, 20h, 00h ; uncompressed 90 db 59h, 31h, 00h ; compressed 91 92 g_szBusTypeValues_16: ; db " 16",NULL 93 ; db 20h, 31h, 36h, 00h ; uncompressed 94 db 20h, 2bh, 10h ; compressed 95 96 g_szBusTypeValues_32: ; db " 32",NULL 97 ; db 20h, 33h, 32h, 00h ; uncompressed 98 db 20h, 2dh, 0ch ; compressed 99 100 g_szBusTypeValues_Serial: ; db "SER",NULL 101 ; db 53h, 45h, 52h, 00h ; uncompressed 102 db 59h, 4bh, 98h ; compressed 103 104 g_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 129 g_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 134 g_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 ; 145 g_szFddStart: 146 g_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 150 g_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 154 g_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 158 g_szFddThreeHalf: ; db "3",ONE_HALF,NULL 159 ; db 33h, 0abh, 00h ; uncompressed 160 db 2dh, 02h ; compressed 161 162 g_szFddEnd: 163 g_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 19 174 ; The following strings are used by DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP 20 175 ; To support an optimization in that code, these strings must start on the same 256 byte page, … … 34 189 db 4fh, 4ah, 0cbh, 3eh, 20h, 67h, 0fah, 3eh, 40h, 00h ; compressed 35 190 36 g_szDetectOuterSerial: ; db "Serial %s on %s: ",NULL 191 %ifdef MODULE_SERIAL ;%%; is stripped off after string compression, %ifdef won't compress properly 192 g_szDetectOuterSerial: ; db "Serial %s on %s: ",NULL 37 193 ; db 53h, 65h, 72h, 69h, 61h, 6ch, 20h, 25h, 73h, 20h, 6fh, 6eh, 20h, 25h, 73h, 3ah, 20h, 00h ; uncompressed 38 194 db 59h, 6bh, 78h, 6fh, 67h, 0f2h, 3eh, 20h, 75h, 0f4h, 3eh, 40h, 00h ; compressed 39 195 196 g_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 200 g_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 204 g_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 208 g_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 213 g_szDetectEnd: 40 214 g_szDetectPort: ; db "%x",NULL ; IDE Master at 1F0h: 41 215 ; db 25h, 78h, 00h ; uncompressed 42 216 db 19h ; compressed 43 44 g_szDetectCOM: ; db "COM%c%s",NULL45 ; db 43h, 4fh, 4dh, 25h, 63h, 25h, 73h, 00h ; uncompressed46 db 49h, 55h, 53h, 35h, 1eh ; compressed47 48 g_szDetectCOMAuto: ; db " Detect",NULL49 ; db 20h, 44h, 65h, 74h, 65h, 63h, 74h, 00h ; uncompressed50 db 20h, 4ah, 6bh, 7ah, 6bh, 69h, 0bah ; compressed51 52 g_szDetectCOMSmall: ; db "/%u%u00",NULL ; IDE Master at COM1/9600:53 ; db 2fh, 25h, 75h, 25h, 75h, 30h, 30h, 00h ; uncompressed54 db 2ah, 37h, 37h, 34h, 14h ; compressed55 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 ; uncompressed59 db 2ah, 37h, 29h, 37h, 91h ; compressed60 217 61 218 … … 97 254 %endif 98 255 99 ; POST drive detection strings100 g_szRomAt: ; db "%s @ %x",LF,CR,NULL101 ; db 25h, 73h, 20h, 40h, 20h, 25h, 78h, 0ah, 0dh, 00h ; uncompressed102 db 3eh, 20h, 0c6h, 39h, 1bh ; compressed103 104 105 ; Boot loader strings106 g_szTryToBoot: ; db "Booting from %s %x",ANGLE_QUOTE_RIGHT,"%x",LF,CR,NULL107 ; 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 ; uncompressed108 db 48h, 75h, 75h, 7ah, 6fh, 74h, 0edh, 6ch, 78h, 75h, 0f3h, 3eh, 20h, 39h, 24h, 39h, 1bh ; compressed109 110 g_szBootSectorNotFound: ; db "Boot sector "111 ; db 42h, 6fh, 6fh, 74h, 20h, 73h, 65h, 63h, 74h, 6fh, 72h, 20h ; uncompressed112 db 48h, 75h, 75h, 0fah, 79h, 6bh, 69h, 7ah, 75h, 0f8h ; compressed113 114 g_szNotFound: ; db "not found",LF,CR,NULL115 ; db 6eh, 6fh, 74h, 20h, 66h, 6fh, 75h, 6eh, 64h, 0ah, 0dh, 00h ; uncompressed116 db 74h, 75h, 0fah, 6ch, 75h, 7bh, 74h, 6ah, 1bh ; compressed117 118 g_szReadError: ; db "Error %x!",LF,CR,NULL119 ; db 45h, 72h, 72h, 6fh, 72h, 20h, 25h, 78h, 21h, 0ah, 0dh, 00h ; uncompressed120 db 4bh, 78h, 78h, 75h, 0f8h, 39h, 25h, 1bh ; compressed121 122 123 256 ; Boot menu bottom of screen strings 124 257 g_szFDD: ; db "FDD ",NULL … … 160 293 db 3eh, 23h, 38h, 23h, 3eh, 23h, 20h, 36h, 23h, 1ah ; compressed 161 294 162 163 g_szAddressingModes:164 g_szLCHS: ; db "L-CHS",NULL165 ; db 4ch, 2dh, 43h, 48h, 53h, 00h ; uncompressed166 db 52h, 28h, 49h, 4eh, 99h ; compressed167 168 g_szPCHS: ; db "P-CHS",NULL169 ; db 50h, 2dh, 43h, 48h, 53h, 00h ; uncompressed170 db 56h, 28h, 49h, 4eh, 99h ; compressed171 172 g_szLBA28: ; db "LBA28",NULL173 ; db 4ch, 42h, 41h, 32h, 38h, 00h ; uncompressed174 db 52h, 48h, 47h, 2ch, 11h ; compressed175 176 g_szLBA48: ; db "LBA48",NULL177 ; db 4ch, 42h, 41h, 34h, 38h, 00h ; uncompressed178 db 52h, 48h, 47h, 2eh, 11h ; compressed179 180 g_szAddressingModes_Displacement equ (g_szPCHS - g_szAddressingModes)181 ;182 ; Ensure that addressing modes are correctly spaced in memory183 ;184 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS185 %if g_szLCHS <> g_szAddressingModes186 %error "g_szAddressingModes Displacement Incorrect 1"187 %endif188 %if g_szPCHS <> g_szLCHS + g_szAddressingModes_Displacement189 %error "g_szAddressingModes Displacement Incorrect 2"190 %endif191 %if g_szLBA28 <> g_szPCHS + g_szAddressingModes_Displacement192 %error "g_szAddressingModes Displacement Incorrect 3"193 %endif194 %if g_szLBA48 <> g_szLBA28 + g_szAddressingModes_Displacement195 %error "g_szAddressingModes Displacement Incorrect 4"196 %endif197 %endif198 199 g_szBusTypeValues:200 g_szBusTypeValues_8Dual: ; db "D8 ",NULL201 ; db 44h, 38h, 20h, 00h ; uncompressed202 db 4ah, 31h, 00h ; compressed203 204 g_szBusTypeValues_8Reversed: ; db "X8 ",NULL205 ; db 58h, 38h, 20h, 00h ; uncompressed206 db 5eh, 31h, 00h ; compressed207 208 g_szBusTypeValues_8Single: ; db "S8 ",NULL209 ; db 53h, 38h, 20h, 00h ; uncompressed210 db 59h, 31h, 00h ; compressed211 212 g_szBusTypeValues_16: ; db " 16",NULL213 ; db 20h, 31h, 36h, 00h ; uncompressed214 db 20h, 2bh, 10h ; compressed215 216 g_szBusTypeValues_32: ; db " 32",NULL217 ; db 20h, 33h, 32h, 00h ; uncompressed218 db 20h, 2dh, 0ch ; compressed219 220 g_szBusTypeValues_Serial: ; db "SER",NULL221 ; db 53h, 45h, 52h, 00h ; uncompressed222 db 59h, 4bh, 98h ; compressed223 224 g_szBusTypeValues_Displacement equ (g_szBusTypeValues_8Reversed - g_szBusTypeValues)225 ;226 ; Ensure that bus type strings are correctly spaced in memory227 ;228 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS229 %if g_szBusTypeValues_8Dual <> g_szBusTypeValues230 %error "g_szBusTypeValues Displacement Incorrect 1"231 %endif232 %if g_szBusTypeValues_8Reversed <> g_szBusTypeValues + g_szBusTypeValues_Displacement233 %error "g_szBusTypeValues Displacement Incorrect 2"234 %endif235 %if g_szBusTypeValues_8Single <> g_szBusTypeValues_8Reversed + g_szBusTypeValues_Displacement236 %error "g_szBusTypeValues Displacement Incorrect 3"237 %endif238 %if g_szBusTypeValues_16 <> g_szBusTypeValues_8Single + g_szBusTypeValues_Displacement239 %error "g_szBusTypeValues Displacement Incorrect 4"240 %endif241 %if g_szBusTypeValues_32 <> g_szBusTypeValues_16 + g_szBusTypeValues_Displacement242 %error "g_szBusTypeValues Displacement Incorrect 5"243 %endif244 %if g_szBusTypeValues_Serial <> g_szBusTypeValues_32 + g_szBusTypeValues_Displacement245 %error "g_szBusTypeValues Displacement Incorrect 6"246 %endif247 %endif248 249 g_szSelectionTimeout: ; db DOUBLE_BOTTOM_LEFT_CORNER,DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL,"%ASelection in %2-u s",NULL250 ; 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 ; uncompressed251 db 32h, 33h, 3dh, 59h, 6bh, 72h, 6bh, 69h, 7ah, 6fh, 75h, 0f4h, 6fh, 0f4h, 3ch, 20h, 0b9h ; compressed252 253 254 g_szDashForZero: ; db "- ",NULL255 ; db 2dh, 20h, 00h ; uncompressed256 db 28h, 00h ; compressed257 258 259 ; Boot Menu Floppy Disk strings260 ;261 ; The following strings are used by BootMenuPrint_RefreshInformation262 ; 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",NULL267 ; db 55h, 6eh, 6bh, 6eh, 6fh, 77h, 6eh, 00h ; uncompressed268 db 5bh, 74h, 71h, 74h, 75h, 7dh, 0b4h ; compressed269 270 g_szFddSizeOr: ; db "5",ONE_QUARTER,QUOTATION_MARK," or 3",ONE_HALF,QUOTATION_MARK," DD",NULL271 ; db 35h, 0ach, 22h, 20h, 6fh, 72h, 20h, 33h, 0abh, 22h, 20h, 44h, 44h, 00h ; uncompressed272 db 2fh, 21h, 26h, 20h, 75h, 0f8h, 2dh, 22h, 26h, 20h, 4ah, 8ah ; compressed273 274 g_szFddSize: ; db "%s",QUOTATION_MARK,", %u kiB",NULL ; 3½", 1440 kiB275 ; db 25h, 73h, 22h, 2ch, 20h, 25h, 75h, 20h, 6bh, 69h, 42h, 00h ; uncompressed276 db 3eh, 26h, 27h, 20h, 37h, 20h, 71h, 6fh, 88h ; compressed277 278 g_szFddThreeHalf: ; db "3",ONE_HALF,NULL279 ; db 33h, 0abh, 00h ; uncompressed280 db 2dh, 02h ; compressed281 282 g_szFddEnd:283 g_szFddFiveQuarter: ; db "5",ONE_QUARTER,NULL284 ; db 35h, 0ach, 00h ; uncompressed285 db 2fh, 01h ; compressed286 287 288 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS289 %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 %endif292 %endif293 295 294 296 ;------------------------------------------------------------------------------------------ -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm
r271 r277 43 43 ; 44 44 call RamVars_UnpackFlopCntAndFirstToAL 45 cbw ; normally 0h, could be ffh if no drives present46 adc ah, al ; if no drives present, still ffh (ffh + ffh + 1 = ffh)47 45 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 48 50 cmp ah, dl ; Check second drive if two, first drive if only one 49 51 jz SHORT .CalcDPTForDriveNumber -
trunk/XTIDE_Universal_BIOS/makefile
r272 r277 60 60 LIBS += ../Assembly_Library/Src/Time/ 61 61 LIBS += ../Assembly_Library/Src/Util/ 62 LIBS += ../Assembly_Library/Src/Serial/ 62 63 LIBS += ../XTIDE_Universal_BIOS/Inc/ 63 64 HEADERS += $(LIBS) … … 164 165 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -l"$(TARGET)_xtl.lst" -o"$(TARGET)_xtl.bin" 165 166 @echo *15k XT version "$(TARGET)_xtl.bin" built. 166 167 167 168 jride_8k: 168 169 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_JRIDE_8K) -l"$(TARGET)_jr8k.lst" -o"$(TARGET)_jr8k.bin" … … 185 186 186 187 src\StringsCompressed.asm: src\Strings.asm 187 @$(AS) src\Strings.asm $(ASFLAGS) $(DEFS_XT) -D MODULE_STRINGS_COMPRESSED_PRECOMPRESS -o build\Strings.bin -l build\StringsPrecompress.lst188 @$(AS) src\Strings.asm $(ASFLAGS) $(DEFS_XT) -DCHECK_FOR_UNUSED_ENTRYPOINTS -DMODULE_STRINGS_COMPRESSED_PRECOMPRESS -o build\Strings.bin -l build\StringsPrecompress.lst 188 189 @perl ..\tools\StringsCompress.pl < build\StringsPrecompress.lst > src\StringsCompressed.asm 189 190 @echo StringsCompressed.asm updated!
Note:
See TracChangeset
for help on using the changeset viewer.