[syslinux] [PATCH] core: Honor DISPLAY text background color when in VGA mode

Jeffrey Hutzelman jhutz at cmu.edu
Fri Feb 18 05:42:42 PST 2011


When in VGA graphics mode, BIOS int 10h ah=09h doesn't seem to
treat high-order attribute bits as a background color; instead,
it apparently always uses black.  This means that a background
color requested via <SI> in a DISPLAY file is not honored in
VGA mode.

However, the BIOS supports an "XOR" mode, in which the pixels
to be written are XORed with pixels already on the screen
(background pixels are left untouched).  So, we can get the
desired effect by first writing a solid block in the desired
background color, followed by XORing in the character to be
displayed, using a color which is the XOR of the foreground
and background colors.

This depends on the existence of an all-pixels-set character
at font position 0xDB.

Signed-off-by: Jeffrey Hutzelman <jhutz at cmu.edu>
---
 core/conio.inc |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/core/conio.inc b/core/conio.inc
index b450502..0784e65 100644
--- a/core/conio.inc
+++ b/core/conio.inc
@@ -100,9 +100,25 @@ msg_normal:	call write_serial_displaymask	; Write to serial port
 		jz msg_ignore
                 mov bl,[TextAttribute]
 		mov bh,[BIOS_page]
+                cmp cl,02h
+                jnz .text
+                push ax
+                mov al,0xdb                     ; solid block
+                shr bl,4                        ; background color
                 mov ah,09h                      ; Write character/attribute
                 mov cx,1                        ; One character only
                 int 10h                         ; Write to screen
+                pop ax
+                mov bl,[TextAttribute]
+                and bl,0fh                      ; foreground color
+                mov bh,[TextAttribute]
+                shr bh,4                        ; background color
+                xor bl,bh
+                or bl,80h                       ; XOR mode
+                mov bh,[BIOS_page]
+.text:          mov ah,09h                      ; Write character/attribute
+                mov cx,1                        ; One character only
+                int 10h                         ; Write to screen
                 mov al,[CursorCol]
                 inc ax
                 cmp al,[VidCols]
-- 
1.7.1




More information about the Syslinux mailing list