Index: /trunk/Assembly_Library/Inc/Display.inc
===================================================================
--- /trunk/Assembly_Library/Inc/Display.inc	(revision 185)
+++ /trunk/Assembly_Library/Inc/Display.inc	(revision 186)
@@ -4,4 +4,5 @@
 %define DISPLAY_INC
 
+%ifndef MODULE_STRINGS_COMPRESSED_PRECOMPRESS
 ;--------------------------------------------------------------------
 ; Display Library users need to use this macro since it will provide
@@ -197,4 +198,5 @@
 CGA_STATUS_REGISTER				EQU		3DAh
 
+%endif ; MODULE_STRINGS_COMPRESS_PRECOMPRESS
 
 ; Control characters for teletype output
Index: /trunk/Assembly_Library/Src/AssemblyLibrary.asm
===================================================================
--- /trunk/Assembly_Library/Src/AssemblyLibrary.asm	(revision 185)
+++ /trunk/Assembly_Library/Src/AssemblyLibrary.asm	(revision 186)
@@ -13,6 +13,10 @@
 	%include "DisplayCursor.asm"
 	%include "DisplayPage.asm"
-	%include "DisplayPrint.asm"
-	%include "DisplayFormat.asm"
+	%include "DisplayPrint.asm"					; must come before DisplayFormat/DisplayFormatCompressed			
+%ifdef MODULE_STRINGS_COMPRESSED
+	%include "DisplayFormatCompressed.asm"
+%else
+	%include "DisplayFormat.asm"		
+%endif
 %endif
 
Index: /trunk/Assembly_Library/Src/Display/DisplayFormatCompressed.asm
===================================================================
--- /trunk/Assembly_Library/Src/Display/DisplayFormatCompressed.asm	(revision 186)
+++ /trunk/Assembly_Library/Src/Display/DisplayFormatCompressed.asm	(revision 186)
@@ -0,0 +1,245 @@
+; Project name	:	Assembly Library
+; Description	:	Functions for displaying formatted strings.
+;                   ** Compressed Strings edition **
+;
+; Authors   	:	Greg Lindhorst
+;				:	gregli@hotmail.com
+;               :		
+;				:	Tomi Tilli
+;				:	aitotat@gmail.com
+;				:
+; Description	:	This is a plug replacement for DisplayFormat.asm,
+;                   working instead with precompiled and slightly compressed strings.
+;
+; Strings are compressed in a simple manner:
+;	1. The two most common characters, space and null, are removed
+;   2. Format specifiers are reduced to a single byte, including length information
+;
+; Format of bytes in the string are:
+;     01 xxxxxx     Character in x plus StringsCompressed_NormalBase
+;     10 xxxxxx     Character in x plus StringsCompressed_NormalBase, followed by a null (last character)
+;     11 xxxxxx     Character in x plus StringsCompressed_NormalBase, followed by a space		
+;     00 1 yyyyy    Character/Format in lookup table StringsCopmressed_TranslatesAndFormats
+;     00 0 yyyyy    Character/Format in lookup table StringsCompressed_TranslatesAndFormats, followed by a null
+;
+; StringsCompressed_NormalBase is defined by the compressor, but is usually around 0x40,
+; which gives a range of 0x40 to 0x7f, or roughly the upper and lower case letters.
+;
+; StringsCompressed_TranslatesAndFormats is a lookup table with the first few bytes being translation
+; characters, and the last few bytes being format jump offsets from DisplayFormatCompressed_BaseFormatOffset.
+; The dividing line is defined by StringsCompressed_FormatsBegin
+;
+; The assignments of the first two bits above is not by accident.  The translates/format branch is 00
+; which is easy to test for.  The '01' for "normal" (no null or space) and '001' for translates/format "normal" 
+; match, allowing the translates/format codes to be shifted left by 1 and then tested with the same instructions.
+;
+; It is always possible to say that a null character follows the current character - thus there is 
+; no way (nor need) to specify a zero character.
+;
+; Note that this code is optimized for size, not speed.  Since this code is used only during initialization
+; and only for the user interface, small performance hits should not be noticed.  It will seem odd to do so
+; much "preload", just in case a branch is taken, but that is cheaper (in size) than adding additional branches.
+;
+		
+; Section containing code
+SECTION .text
+
+;--------------------------------------------------------------------
+; Format Handlers
+;
+; Names of format handlers are DisplayFormatCompressed_Format_* where * is
+; replaced with the format code after the '%' in the original string, 
+; with '-' replaced with '_'.
+;
+;	Parameters:
+;		DS:		BDA segment (zero)
+;		AX:     Parameter to Format
+;		ES:DI:	Ptr to cursor location in video RAM
+;	Returns:
+;		DI:		Updated offset to video RAM
+;	Corrupts registers:
+;		AX, BX, CX, DX, SI
+;--------------------------------------------------------------------
+
+;
+; The following routines do not need any pre or post processing and can be jumped to directly.
+; Note that they need to be within 256 bytes of DisplayFormatCompressed_BaseFormatOffset
+;
+%define DisplayFormatCompressed_Format_c DisplayPrint_CharacterFromAL
+%define DisplayFormatCompressed_Format_nl DisplayPrint_Newline_FormatAdjustBP
+%define DisplayFormatCompressed_Format_s DisplayFormat_ParseCharacters_FromAX
+
+DisplayFormatCompressed_Format_A:	
+	mov		[VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bAttribute], al
+DisplayFormatCompressed_ret:			; jump target for other routines who need a "ret"
+	ret
+
+DisplayFormatCompressed_Format_x:
+DisplayFormatCompressed_Format_5_x:
+	mov		si,16						; hex output, change base to 16
+	mov		bx,(04<<8) + 'h'	        ; 4 bytes, with postfix character 'h' to emit
+										; (note that the count includes the 'h')
+	jmp		DisplayFormatCompressed_Format_u
+
+DisplayFormatCompressed_Format_2_I:
+	mov		si,g_szDashForZero			; preload dash string in case we jump
+	test	ax,ax						; if parameter equals zero, emit dash string instead
+	jz		DisplayFormat_ParseCharacters
+;;; fall through
+		
+DisplayFormatCompressed_Format_2_u:
+	mov		bh,2						; only two characters (instead of the default 5)
+;;; fall through
+		
+DisplayFormatCompressed_Format_u:
+DisplayFormatCompressed_Format_5_u:
+	push	bx							; push postfix character - either a zero (default) or a 'h'
+	mov		bl,bh						; preserve character count for .PrintLoop
+
+.DivLoop:
+	xor		dx, dx						; Zero DX for division
+	div		si							; DX:AX / 10 => AX=quot, DX=rem
+ 	push	dx							; Push digit
+		
+	dec		bh							
+	jnz		.DivLoop
+
+.PrintLoop:
+	pop		ax							; Pop digit, postfix character on last iteration
+
+	dec		bl							; on second to last iteration, emit digit whether it is zero or not
+	jz		.PrintDigit
+
+	js		short DisplayPrint_CharacterFromAL	; on last iteration, emit postfix character
+												; if it is zero, DisplayPrint_CharacterFromAL will not emit
+
+	or		dh, al						; skip leading zeros, dh keeps track if we have emitted anythng non-zero
+	jnz		.PrintDigit					; note that dh starts at zero, from the div instruction in .DivLoop
+
+	test	ch,2						; are we padding with leading spaces?  
+	jnz		.PrintLoop					; test the even/odd of the format byte in the string
+
+	mov		al,' '-'0'					; emit space, but let the following instuctions add '0'
+
+.PrintDigit:	
+	add		al,'0'						; Digit to character
+	cmp		al,'9'						; for hex output, greater than '9'?
+	jle		.NoHexAdjustment
+	add		al,'A'-'9'-1				; adjust for hex output ('A' to 'F')
+.NoHexAdjustment:		
+
+	push	dx								; preserve dh for future iterations
+	call	DisplayPrint_CharacterFromAL
+	pop		dx							
+
+	jmp		.PrintLoop
+
+		
+;--------------------------------------------------------------------
+; DisplayFormat_ParseCharacters
+;	Parameters:
+;		DS:		BDA segment (zero)
+;		SS:BP:	Pointer to first format parameter (-=2 updates to next parameter)
+;		CS:SI:	Pointer to string to format
+;		ES:DI:	Ptr to cursor location in video RAM
+;	Returns:
+;		CS:SI:	Ptr to end of format string (ptr to one past NULL)
+;		DI:		Updated offset to video RAM
+;	Corrupts registers:
+;		AX, BX, CX, DX, BP
+;--------------------------------------------------------------------		
+
+DisplayFormatCompressed_BaseFormatOffset:	
+		
+DisplayFormat_ParseCharacters_FromAX:	
+	mov		si,ax
+;;; Fall-through
+
+ALIGN JUMP_ALIGN		
+DisplayFormat_ParseCharacters:	
+;
+; This routine is used to outptu all strings from the ROM.  The strings in ROMVARS are not compressed, 
+; and must be handled differently.
+;
+	cmp		si,byte 07fh		; well within the boundaries of ROMVARS_size
+	mov		bx,cs				; preload bx with cs in case we take the following jump
+	jb		short DisplayPrint_NullTerminatedStringFromBXSI
+
+.decode:
+	mov		al,[cs:si]			; load next byte of the string
+	inc		si
+
+	mov		ch,al				; save a copy for later processing of high order bits
+
+	test	al,0c0h				; check for translation/format character
+	jz		DisplayFormatCompressed_TranslatesAndFormats
+
+	and		al,03fh								; "Normal" character, mask off high order bits
+	add		al,StringsCompressed_NormalBase		; and add character offset (usually around 0x40)
+		
+.output:
+	call 	DisplayPrint_CharacterFromAL		
+
+.process_after_output:
+	shl		ch,1								; check high order bits for end of string or space
+	jns		short DisplayFormatCompressed_ret
+	jnc		.decode
+	mov		al,' '
+	call	DisplayPrint_CharacterFromAL
+	jmp		.decode
+
+
+ALIGN JUMP_ALIGN
+DisplayFormatCompressed_TranslatesAndFormats:		
+;
+; This routine is here (above DisplayFormat_ParseCharacters) to reduce the amount of code between
+; DisplayFormatCompressed_BaseFormatOffset and jump targets (must fit in 256 bytes)
+;
+	shl		ch,1				; setup ch for later testing of null in .process_after_output
+	and		ax,0001fh			; also clears AH for addition with BX and DX below
+
+	mov		bx,StringsCompressed_TranslatesAndFormats	; calculate offset of translation/formats offset byte
+	add		bx,ax
+
+	cmp		al,StringsCompressed_FormatsBegin			; determine if this is a translation or a format
+														
+	mov		al,[cs:bx]									; fetch translation/formats byte
+
+	jb		DisplayFormat_ParseCharacters.output		; check if this a translation or a format
+														; if it is translation, output and postprocess for eos
+														; note that the flags for this conditional jump were
+														; set with the cmp al,StringsCompressed_FormatsBegin
+		
+	mov		dx,DisplayFormatCompressed_BaseFormatOffset   ; calculate address to jump to for format handler
+	sub		dx,ax
+
+	mov		ax,[bp]				; preload ax with parameter
+	dec		bp					; if no parameter is needed (format 'nl' for example),
+	dec		bp					; the format handler can reincrement bp
+
+	mov		bx,0500h			; preload bh with 5 decimal places for numeric output
+								; bl is zero, indicating not to output a 'h' (default base 10)
+
+	push	si					; preserve si and cx, in the case of outputing a string
+	push	cx
+
+	mov		si,10				; preload si with 10 for numeric output (default base 10)
+
+	call	dx					; call the format routine
+
+	pop		cx					; restore cx and si
+	pop		si
+
+	jmp		DisplayFormat_ParseCharacters.process_after_output	; continue postprocessing, check for end of string
+
+
+
+
+
+
+		
+
+		
+	
+
+
Index: /trunk/Assembly_Library/Src/Display/DisplayPrint.asm
===================================================================
--- /trunk/Assembly_Library/Src/Display/DisplayPrint.asm	(revision 185)
+++ /trunk/Assembly_Library/Src/Display/DisplayPrint.asm	(revision 186)
@@ -5,4 +5,5 @@
 SECTION .text
 
+				
 ;--------------------------------------------------------------------
 ; Supports following formatting types:
@@ -61,4 +62,5 @@
 	pop		si
 	pop		bp
+
 	ret
 
@@ -102,4 +104,7 @@
 ;		AX, DX
 ;--------------------------------------------------------------------
+		
+%ifndef MODULE_STRINGS_COMPRESSED
+		
 ALIGN JUMP_ALIGN
 DisplayPrint_WordFromAXWithBaseInBX:
@@ -131,4 +136,6 @@
 .rgcDigitToCharacter:	db	"0123456789ABCDEF"
 
+%endif	; MODULE_STRINGS_COMPRESSED
+
 
 ;--------------------------------------------------------------------
@@ -165,56 +172,4 @@
 
 
-;--------------------------------------------------------------------
-; DisplayPrint_NullTerminatedStringFromCSSI
-;	Parameters:
-;		CS:SI:	Ptr to NULL terminated string
-;		DS:		BDA segment (zero)
-;		ES:DI:	Ptr to cursor location in video RAM
-;	Returns:
-;		DI:		Updated offset to video RAM
-;	Corrupts registers:
-;		AX, DX
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-DisplayPrint_NullTerminatedStringFromCSSI:
-	push	bx
-	mov		bx, cs
-	call	DisplayPrint_NullTerminatedStringFromBXSI
-	pop		bx
-	ret
-
-
-;--------------------------------------------------------------------
-; DisplayPrint_NullTerminatedStringFromBXSI
-;	Parameters:
-;		DS:		BDA segment (zero)
-;		BX:SI:	Ptr to NULL terminated string
-;		ES:DI:	Ptr to cursor location in video RAM
-;	Returns:
-;		DI:		Updated offset to video RAM
-;	Corrupts registers:
-;		AX, DX
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-DisplayPrint_NullTerminatedStringFromBXSI:
-	push	si
-	push	cx
-
-	xor		cx, cx
-ALIGN JUMP_ALIGN
-.PrintNextCharacter:
-	mov		ds, bx				; String segment to DS
-	lodsb
-	mov		ds, cx				; BDA segment to DS
-	test	al, al				; NULL?
-	jz		SHORT .EndOfString
-	call	DisplayPrint_CharacterFromAL
-	jmp		SHORT .PrintNextCharacter
-
-ALIGN JUMP_ALIGN
-.EndOfString:
-	pop		cx
-	pop		si
-	ret
 
 
@@ -320,6 +275,41 @@
 	pop		cx
 .NothingToRepeat:
-	ret
-
+
+	ret
+
+;--------------------------------------------------------------------
+; DisplayPrint_NullTerminatedStringFromCSSI
+;	Parameters:
+;		CS:SI:	Ptr to NULL terminated string
+;		DS:		BDA segment (zero)
+;		ES:DI:	Ptr to cursor location in video RAM
+;	Returns:
+;		DI:		Updated offset to video RAM
+;	Corrupts registers:
+;		AX, DX
+;--------------------------------------------------------------------
+
+%ifndef MODULE_STRINGS_COMPRESSED
+;;;
+;;; Take care when using this routine with compressed strings (which is why it is disabled).
+;;; All strings in CSSI should go through the DisplayFormatCompressed code to be decoded.
+;;; 
+ALIGN JUMP_ALIGN
+DisplayPrint_NullTerminatedStringFromCSSI:
+	push	bx
+	mov		bx, cs
+	call	DisplayPrint_NullTerminatedStringFromBXSI
+	pop		bx
+
+	ret
+%endif
+
+		
+
+
+;;;
+;;; Note that the following routines need to be at the bottom of this file
+;;; to accomodate short jumps from the next file (DisplayFormat/DisplayFormatCompressed)
+;;; 
 
 ;--------------------------------------------------------------------
@@ -333,5 +323,14 @@
 ;		AX, DX
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
+%ifdef MODULE_STRINGS_COMPRESSED
+ALIGN JUMP_ALIGN
+DisplayPrint_Newline_FormatAdjustBP:
+	inc		bp					; we didn't need a parameter after all, readjust BP 
+	inc		bp
+;;; fall-through
+%endif
+
+ALIGN JUMP_ALIGN
+		
 DisplayPrint_Newline:
 	mov		al, LF
@@ -344,4 +343,5 @@
 ;	Parameters:
 ;		AL:		Character to display
+;               Zero value is ignored (no characer is printed)
 ;		DS:		BDA segment (zero)
 ;		ES:DI:	Ptr to cursor location in video RAM
@@ -353,4 +353,47 @@
 ALIGN JUMP_ALIGN
 DisplayPrint_CharacterFromAL:
+%ifdef MODULE_STRINGS_COMPRESSED
+	test	al,al
+	jz		DisplayPrint_Ret
+%endif
 	mov		ah, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bAttribute]
 	jmp		[VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fnCharOut]
+
+
+		
+;--------------------------------------------------------------------
+; DisplayPrint_NullTerminatedStringFromBXSI
+;	Parameters:
+;		DS:		BDA segment (zero)
+;		BX:SI:	Ptr to NULL terminated string
+;		ES:DI:	Ptr to cursor location in video RAM
+;	Returns:
+;		DI:		Updated offset to video RAM
+;	Corrupts registers:
+;		AX, DX
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+DisplayPrint_NullTerminatedStringFromBXSI:
+	push	si
+	push	cx
+
+	xor		cx, cx
+ALIGN JUMP_ALIGN
+.PrintNextCharacter:
+	mov		ds, bx				; String segment to DS
+	lodsb
+	mov		ds, cx				; BDA segment to DS
+	test	al, al				; NULL?
+	jz		SHORT .EndOfString
+	call	DisplayPrint_CharacterFromAL
+	jmp		SHORT .PrintNextCharacter
+
+ALIGN JUMP_ALIGN
+.EndOfString:
+	pop		cx
+	pop		si
+		
+DisplayPrint_Ret:				; random ret to jump to 				
+	ret
+
+
Index: /trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm	(revision 185)
+++ /trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm	(revision 186)
@@ -66,14 +66,17 @@
 ;		CF:		Set since menu event was handled successfully
 ;	Corrupts registers:
-;		AX
+;		AX, DI
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
 BootMenuPrint_NullTerminatedStringFromCSSIandSetCF:
-	push	di
-	CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
-	pop		di
-	stc
-	ret
-
+;
+; We send all CSSI strings through the Format routine for the case of
+; compressed strings, but this doesn't hurt in the non-compressed case either
+; (perhaps a little slower, but shouldn't be noticeable to the user)
+; and results in smaller code size.
+;
+	push	bp
+	mov		bp,sp
+	jmp		BootMenuPrint_FormatCSSIfromParamsInSSBP
 
 ;--------------------------------------------------------------------
@@ -229,5 +232,10 @@
 	cmp		bl, FLOPPY_TYPE_525_HD
 	ja		.ThreeHalf
+%if g_szFddThreeFive_Displacement = 2 		
+	inc		ax						; compressed string case
+	inc		ax
+%else
 	add		ax, g_szFddThreeFive_Displacement
+%endif
 .ThreeHalf:		
 	push	ax						; "5 1/4" or "3 1/2"
Index: /trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrintCfg.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrintCfg.asm	(revision 185)
+++ /trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrintCfg.asm	(revision 186)
@@ -21,7 +21,7 @@
 ALIGN JUMP_ALIGN
 BootMenuPrintCfg_ForOurDrive:
-	pop		di
 	mov		si, g_szCfgHeader
 	call	BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
+	pop		di
 	eMOVZX	ax, BYTE [di+DPT.bIdevarsOffset]
 	xchg	si, ax						; CS:SI now points to IDEVARS
@@ -91,5 +91,7 @@
 	mov		al,g_szBusTypeValues_Displacement
 	mul		BYTE [cs:si+IDEVARS.bDevice]
-	shr		ax,1
+		
+	shr		ax,1			; divide by 2 since IDEVARS.bDevice is multiplied by 2
+		
 	add		ax,g_szBusTypeValues
 	push	ax	
Index: /trunk/XTIDE_Universal_BIOS/Src/Main.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Main.asm	(revision 185)
+++ /trunk/XTIDE_Universal_BIOS/Src/Main.asm	(revision 186)
@@ -153,5 +153,9 @@
 	; Libraries and data
 	%include "AssemblyLibrary.asm"
+%ifdef MODULE_STRINGS_COMPRESSED
+	%include "StringsCompressed.asm"
+%else
 	%include "Strings.asm"			; For BIOS message strings
+%endif
 
 	; Initialization and drive detection
Index: /trunk/XTIDE_Universal_BIOS/Src/Strings.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Strings.asm	(revision 185)
+++ /trunk/XTIDE_Universal_BIOS/Src/Strings.asm	(revision 186)
@@ -1,4 +1,8 @@
 ; Project name	:	XTIDE Universal BIOS
 ; Description	:	Strings and equates for BIOS messages.
+
+%ifdef MODULE_STRINGS_COMPRESSED_PRECOMPRESS
+%include "Display.inc"
+%endif
 
 ; Section containing code
@@ -19,8 +23,8 @@
 
 ; Boot menu bottom of screen strings
-g_szFDD:		db	"FDD",NULL
-g_szHDD:		db	"HDD",NULL
+g_szFDD:		db	"FDD     ",NULL
+g_szHDD:		db	"HDD     ",NULL
 g_szRomBoot:	db	"ROM Boot",NULL
-g_szHotkey:		db	"%A%c%c%A%8s%A ",NULL
+g_szHotkey:		db	"%A%c%c%A%s%A ",NULL
 
 
@@ -34,5 +38,5 @@
 g_szCapacity:	db	"Capacity : ",NULL
 g_szSizeSingle:	db	"%s%u.%u %ciB",NULL
-g_szSizeDual:	db	"%s%4-u.%u %ciB / %4-u.%u %ciB",LF,CR,NULL
+g_szSizeDual:	db	"%s%5-u.%u %ciB /%5-u.%u %ciB",LF,CR,NULL
 g_szCfgHeader:	db	"Addr.",SINGLE_VERTICAL,"Block",SINGLE_VERTICAL,"Bus",  SINGLE_VERTICAL,"IRQ",  SINGLE_VERTICAL,"Reset",LF,CR,NULL
 g_szCfgFormat:	db	"%s"   ,SINGLE_VERTICAL,"%5-u", SINGLE_VERTICAL,"%s",SINGLE_VERTICAL," %2-I",SINGLE_VERTICAL,"%5-x",  NULL
@@ -98,5 +102,5 @@
 %endif				
 		
-g_szSelectionTimeout:	db		DOUBLE_BOTTOM_LEFT_CORNER,DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL,"%ASelection in %2u s",NULL
+g_szSelectionTimeout:	db		DOUBLE_BOTTOM_LEFT_CORNER,DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL,"%ASelection in %2-u s",NULL
 
 g_szDashForZero:		db		"- ",NULL
Index: /trunk/XTIDE_Universal_BIOS/Src/StringsCompressed.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/StringsCompressed.asm	(revision 186)
+++ /trunk/XTIDE_Universal_BIOS/Src/StringsCompressed.asm	(revision 186)
@@ -0,0 +1,366 @@
+;;;======================================================================
+;;;
+;;; This file is generated by StringsCompress.pl from source in Strings.asm
+;;; DO NOT EDIT DIRECTLY - See the maekfile for how to rebuild this file.
+;;; This file only needs to be rebuilt if Strings.asm is changed.
+;;;
+;;;======================================================================
+
+; Project name	:	XTIDE Universal BIOS
+; Description	:	Strings and equates for BIOS messages.
+
+%ifdef MODULE_STRINGS_COMPRESSED_PRECOMPRESS
+%include "Display.inc"
+%endif
+
+; Section containing code
+SECTION .text
+
+; POST drive detection strings
+g_szRomAt:
+ db  034h, 020h, 0c6h, 039h, 01bh
+; source:  25h, 73h, 20h, 40h, 20h, 25h, 78h, 0Ah, 0Dh, 00h
+
+g_szMaster:
+ db  053h, 067h, 079h, 07ah, 06bh, 0b8h
+; source:  4Dh, 61h, 73h, 74h, 65h, 72h, 00h
+
+g_szSlave:
+ db  059h, 072h, 067h, 07ch, 06bh, 000h
+; source:  53h, 6Ch, 61h, 76h, 65h, 20h, 00h
+
+g_szDetect:
+ db  04fh, 04ah, 0cbh, 034h, 020h, 067h, 0fah, 039h, 040h, 000h
+; source:  49h, 44h, 45h, 20h, 25h, 73h, 20h, 61h, 74h, 20h, 25h, 78h, 3Ah, 20h, 00h
+
+
+
+; Boot loader strings
+g_szTryToBoot:
+ db  048h, 075h, 075h, 07ah, 06fh, 074h, 0edh, 06ch, 078h, 075h, 0f3h, 034h, 020h, 039h, 024h, 039h, 01bh
+; source:  42h, 6Fh, 6Fh, 74h, 69h, 6Eh, 67h, 20h, 66h, 72h, 6Fh, 6Dh, 20h, 25h, 73h, 20h, 25h, 78h, AFh, 25h, 78h, 0Ah, 0Dh, 00h
+
+g_szBootSectorNotFound:
+ db  048h, 075h, 075h, 0fah, 079h, 06bh, 069h, 07ah, 075h, 078h, 020h
+; source:  42h, 6Fh, 6Fh, 74h, 20h, 73h, 65h, 63h, 74h, 6Fh, 72h, 20h
+
+g_szNotFound:
+ db  074h, 075h, 0fah, 06ch, 075h, 07bh, 074h, 06ah, 01bh
+; source:  6Eh, 6Fh, 74h, 20h, 66h, 6Fh, 75h, 6Eh, 64h, 0Ah, 0Dh, 00h
+
+g_szReadError:
+ db  04bh, 078h, 078h, 075h, 0f8h, 039h, 025h, 01bh
+; source:  45h, 72h, 72h, 6Fh, 72h, 20h, 25h, 78h, 21h, 0Ah, 0Dh, 00h
+
+
+; Boot menu bottom of screen strings
+g_szFDD:
+ db  04ch, 04ah, 0cah, 020h, 020h, 020h, 000h
+; source:  46h, 44h, 44h, 20h, 20h, 20h, 20h, 20h, 00h
+
+g_szHDD:
+ db  04eh, 04ah, 0cah, 020h, 020h, 020h, 000h
+; source:  48h, 44h, 44h, 20h, 20h, 20h, 20h, 20h, 00h
+
+g_szRomBoot:
+ db  058h, 055h, 0d3h, 048h, 075h, 075h, 0bah
+; source:  52h, 4Fh, 4Dh, 20h, 42h, 6Fh, 6Fh, 74h, 00h
+
+g_szHotkey:
+ db  03dh, 035h, 035h, 03dh, 034h, 03dh, 000h
+; source:  25h, 41h, 25h, 63h, 25h, 63h, 25h, 41h, 25h, 73h, 25h, 41h, 20h, 00h
+
+
+
+; Boot Menu menuitem strings
+g_szDriveNum:
+ db  039h, 000h
+; source:  25h, 78h, 20h, 00h
+
+g_szFDLetter:
+ db  034h, 020h, 015h
+; source:  25h, 73h, 20h, 25h, 63h, 00h
+
+g_szFloppyDrv:
+ db  04ch, 072h, 075h, 076h, 076h, 0ffh, 04ah, 078h, 06fh, 07ch, 0abh
+; source:  46h, 6Ch, 6Fh, 70h, 70h, 79h, 20h, 44h, 72h, 69h, 76h, 65h, 00h
+
+g_szforeignHD:
+ db  04ch, 075h, 078h, 06bh, 06fh, 06dh, 0f4h, 04eh, 067h, 078h, 0eah, 04ah, 06fh, 079h, 0b1h
+; source:  46h, 6Fh, 72h, 65h, 69h, 67h, 6Eh, 20h, 48h, 61h, 72h, 64h, 20h, 44h, 69h, 73h, 6Bh, 00h
+
+
+; Boot Menu information strings
+g_szCapacity:
+ db  049h, 067h, 076h, 067h, 069h, 06fh, 07ah, 0ffh, 040h, 000h
+; source:  43h, 61h, 70h, 61h, 63h, 69h, 74h, 79h, 20h, 3Ah, 20h, 00h
+
+g_szSizeSingle:
+ db  034h, 037h, 029h, 037h, 020h, 035h, 06fh, 088h
+; source:  25h, 73h, 25h, 75h, 2Eh, 25h, 75h, 20h, 25h, 63h, 69h, 42h, 00h
+
+g_szSizeDual:
+ db  034h, 038h, 029h, 037h, 020h, 035h, 06fh, 0c8h, 02ah, 038h, 029h, 037h, 020h, 035h, 06fh, 048h, 01bh
+; source:  25h, 73h, 25h, 35h, 2Dh, 75h, 2Eh, 25h, 75h, 20h, 25h, 63h, 69h, 42h, 20h, 2Fh, 25h, 35h, 2Dh, 75h, 2Eh, 25h, 75h, 20h, 25h, 63h, 69h, 42h, 0Ah, 0Dh, 00h
+
+g_szCfgHeader:
+ db  047h, 06ah, 06ah, 078h, 029h, 023h, 048h, 072h, 075h, 069h, 071h, 023h, 048h, 07bh, 079h, 023h, 04fh, 058h, 057h, 023h, 058h, 06bh, 079h, 06bh, 07ah, 01bh
+; source:  41h, 64h, 64h, 72h, 2Eh, B3h, 42h, 6Ch, 6Fh, 63h, 6Bh, B3h, 42h, 75h, 73h, B3h, 49h, 52h, 51h, B3h, 52h, 65h, 73h, 65h, 74h, 0Ah, 0Dh, 00h
+
+g_szCfgFormat:
+ db  034h, 023h, 038h, 023h, 034h, 023h, 020h, 036h, 023h, 01ah
+; source:  25h, 73h, B3h, 25h, 35h, 2Dh, 75h, B3h, 25h, 73h, B3h, 20h, 25h, 32h, 2Dh, 49h, B3h, 25h, 35h, 2Dh, 78h, 00h
+
+
+g_szAddressingModes:					
+g_szLCHS:
+ db  052h, 028h, 049h, 04eh, 099h
+; source:  4Ch, 2Dh, 43h, 48h, 53h, 00h
+
+g_szPCHS:
+ db  056h, 028h, 049h, 04eh, 099h
+; source:  50h, 2Dh, 43h, 48h, 53h, 00h
+
+g_szLBA28:
+ db  052h, 048h, 047h, 02ch, 011h
+; source:  4Ch, 42h, 41h, 32h, 38h, 00h
+
+g_szLBA48:
+ db  052h, 048h, 047h, 02eh, 011h
+; source:  4Ch, 42h, 41h, 34h, 38h, 00h
+
+g_szAddressingModes_Displacement equ (g_szPCHS - g_szAddressingModes)
+;
+; Ensure that addressing modes are correctly spaced in memory
+;
+%if g_szLCHS <> g_szAddressingModes
+%error "g_szAddressingModes Displacement Incorrect 1"
+%endif
+%if g_szPCHS <> g_szLCHS + g_szAddressingModes_Displacement
+%error "g_szAddressingModes Displacement Incorrect 2"
+%endif
+%if g_szLBA28 <> g_szPCHS + g_szAddressingModes_Displacement		
+%error "g_szAddressingModes Displacement Incorrect 3"
+%endif
+%if g_szLBA48 <> g_szLBA28 + g_szAddressingModes_Displacement		
+%error "g_szAddressingModes Displacement Incorrect 4"
+%endif				
+
+g_szFddUnknown:
+ db  034h, 05bh, 074h, 071h, 074h, 075h, 07dh, 0b4h
+; source:  25h, 73h, 55h, 6Eh, 6Bh, 6Eh, 6Fh, 77h, 6Eh, 00h
+
+g_szFddSizeOr:
+ db  034h, 02fh, 021h, 026h, 020h, 075h, 0f8h, 02dh, 022h, 026h, 020h, 04ah, 08ah
+; source:  25h, 73h, 35h, ACh, 22h, 20h, 6Fh, 72h, 20h, 33h, ABh, 22h, 20h, 44h, 44h, 00h
+
+g_szFddSize:
+ db  034h, 034h, 026h, 027h, 020h, 037h, 020h, 071h, 06fh, 088h
+; source:  25h, 73h, 25h, 73h, 22h, 2Ch, 20h, 25h, 75h, 20h, 6Bh, 69h, 42h, 00h
+
+
+g_szFddThreeHalf:
+ db  02dh, 002h
+; source:  33h, ABh, 00h
+
+g_szFddFiveQuarter:
+ db  02fh, 001h
+; source:  35h, ACh, 00h
+
+g_szFddThreeFive_Displacement equ (g_szFddFiveQuarter - g_szFddThreeHalf)
+
+g_szBusTypeValues:		
+g_szBusTypeValues_8Dual:
+ db  04ah, 031h, 000h
+; source:  44h, 38h, 20h, 00h
+
+g_szBusTypeValues_8Reversed:
+ db  05eh, 031h, 000h
+; source:  58h, 38h, 20h, 00h
+
+g_szBusTypeValues_8Single:
+ db  059h, 031h, 000h
+; source:  53h, 38h, 20h, 00h
+
+g_szBusTypeValues_16:
+ db  020h, 02bh, 010h
+; source:  20h, 31h, 36h, 00h
+
+g_szBusTypeValues_32:
+ db  020h, 02dh, 00ch
+; source:  20h, 33h, 32h, 00h
+
+g_szBusTypeValues_Serial:
+ db  059h, 04bh, 098h
+; source:  53h, 45h, 52h, 00h
+
+g_szBusTypeValues_Displacement equ (g_szBusTypeValues_8Reversed - g_szBusTypeValues)
+;
+; Ensure that bus type strings are correctly spaced in memory
+;
+%if g_szBusTypeValues_8Dual <> g_szBusTypeValues
+%error "g_szBusTypeValues Displacement Incorrect 1"
+%endif
+%if g_szBusTypeValues_8Reversed <> g_szBusTypeValues + g_szBusTypeValues_Displacement
+%error "g_szBusTypeValues Displacement Incorrect 2"		
+%endif
+%if g_szBusTypeValues_8Single <> g_szBusTypeValues_8Reversed + g_szBusTypeValues_Displacement
+%error "g_szBusTypeValues Displacement Incorrect 3"				
+%endif
+%if g_szBusTypeValues_16 <> g_szBusTypeValues_8Single + g_szBusTypeValues_Displacement		
+%error "g_szBusTypeValues Displacement Incorrect 4"				
+%endif
+%if g_szBusTypeValues_32 <> g_szBusTypeValues_16 + g_szBusTypeValues_Displacement
+%error "g_szBusTypeValues Displacement Incorrect 5"				
+%endif
+%if g_szBusTypeValues_Serial <> g_szBusTypeValues_32 + g_szBusTypeValues_Displacement
+%error "g_szBusTypeValues Displacement Incorrect 6"				
+%endif				
+
+g_szSelectionTimeout:
+ db  032h, 033h, 03dh, 059h, 06bh, 072h, 06bh, 069h, 07ah, 06fh, 075h, 0f4h, 06fh, 0f4h, 03ch, 020h, 0b9h
+; source:  C8h, B5h, 25h, 41h, 53h, 65h, 6Ch, 65h, 63h, 74h, 69h, 6Fh, 6Eh, 20h, 69h, 6Eh, 20h, 25h, 32h, 2Dh, 75h, 20h, 73h, 00h
+
+
+g_szDashForZero:
+ db  028h, 000h
+; source:  2Dh, 20h, 00h
+
+StringsCompressed_NormalBase equ 58
+
+;; translated usage stats
+;; 179:8
+;; 50:2
+;; 32:33
+;; 51:3
+;; 33:1
+;; 52:1
+;; 34:3
+;; 53:2
+;; 44:1
+;; 54:1
+;; 45:3
+;; 46:4
+;; 56:5
+;; 47:1
+;; 49:1
+;; 200:1
+;; 171:2
+;; 181:1
+;; 172:2
+;; 175:1
+;; total special: 20
+StringsCompressed_TranslatesAndFormats: 
+        db     32  ; 0
+        db     172  ; 1
+        db     171  ; 2
+        db     179  ; 3
+        db     175  ; 4
+        db     33  ; 5
+        db     34  ; 6
+        db     44  ; 7
+        db     45  ; 8
+        db     46  ; 9
+        db     47  ; 10
+        db     49  ; 11
+        db     50  ; 12
+        db     51  ; 13
+        db     52  ; 14
+        db     53  ; 15
+        db     54  ; 16
+        db     56  ; 17
+        db     200  ; 18
+        db     181  ; 19
+
+;; format usage stats
+;; A:4
+;; c:6
+;; s:13
+;; 2-u:1
+;; u:5
+;; 5-u:3
+;; 2-I:1
+;; x:6
+;; 5-x:1
+;; nl:6
+;; total format: 10
+        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_s)  ; 20
+        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_c)  ; 21
+        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_2_I)  ; 22
+        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_u)  ; 23
+        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_5_u)  ; 24
+        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_x)  ; 25
+        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_5_x)  ; 26
+        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_nl)  ; 27
+        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_2_u)  ; 28
+        db     (DisplayFormatCompressed_BaseFormatOffset - DisplayFormatCompressed_Format_A)  ; 29
+
+StringsCompressed_FormatsBegin   equ   20
+
+
+;; alphabet usage stats
+;; 58,::2
+;; 59,;:
+;; 60,<:
+;; 61,=:
+;; 62,>:
+;; 63,?:
+;; 64,@:1
+;; 65,A:3
+;; 66,B:11
+;; 67,C:3
+;; 68,D:10
+;; 69,E:3
+;; 70,F:3
+;; 71,G:
+;; 72,H:4
+;; 73,I:2
+;; 74,J:
+;; 75,K:
+;; 76,L:3
+;; 77,M:2
+;; 78,N:
+;; 79,O:1
+;; 80,P:1
+;; 81,Q:1
+;; 82,R:4
+;; 83,S:6
+;; 84,T:
+;; 85,U:1
+;; 86,V:
+;; 87,W:
+;; 88,X:1
+;; 89,Y:
+;; 90,Z:
+;; 91,[:
+;; 92,\:
+;; 93,]:
+;; 94,^:
+;; 95,_:
+;; 96,`:
+;; 97,a:6
+;; 98,b:
+;; 99,c:4
+;; 100,d:4
+;; 101,e:9
+;; 102,f:2
+;; 103,g:2
+;; 104,h:
+;; 105,i:11
+;; 106,j:
+;; 107,k:4
+;; 108,l:4
+;; 109,m:1
+;; 110,n:9
+;; 111,o:17
+;; 112,p:3
+;; 113,q:
+;; 114,r:11
+;; 115,s:6
+;; 116,t:10
+;; 117,u:2
+;; 118,v:2
+;; 119,w:1
+;; 120,x:
+;; 121,y:2
+;; alphabet used_count: 39
Index: /trunk/XTIDE_Universal_BIOS/makefile
===================================================================
--- /trunk/XTIDE_Universal_BIOS/makefile	(revision 185)
+++ /trunk/XTIDE_Universal_BIOS/makefile	(revision 186)
@@ -65,5 +65,5 @@
 # Assembler preprocessor defines.                               #
 #################################################################
-DEFINES = INCLUDE_MENU_LIBRARY EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS MODULE_EBIOS MODULE_SERIAL
+DEFINES = INCLUDE_MENU_LIBRARY EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS MODULE_EBIOS MODULE_SERIAL MODULE_STRINGS_COMPRESSED
 DEFINES_XT = ELIMINATE_CGA_SNOW
 DEFINES_XTPLUS = ELIMINATE_CGA_SNOW USE_186
@@ -139,2 +139,8 @@
 	@$(RM) $(BUILD_DIR)\*.*
 	@echo Deleted "(*.*)" from "$(BUILD_DIR)/"
+
+src\StringsCompressed.asm:	src\Strings.asm src\StringsCompress.pl
+	$(AS) src\Strings.asm $(ASFLAGS) $(DEFS_XT) -DMODULE_STRINGS_COMPRESSED_PRECOMPRESS -o build\Strings.bin -l build\StringsPrecompress.lst
+	perl src\StringsCompress.pl < build\StringsPrecompress.lst > src\StringsCompressed.asm
+
+$(SRC_ASM):		src\StringsCompressed.asm
