--- include/dc/biosfont.h	2011-02-11 02:08:13.221763002 -0700
+++ include/dc/biosfont-new.h	2011-02-25 12:41:13.901658764 -0700
@@ -30,6 +30,19 @@
 #define BFONT_CODE_EUC          1   /**< \brief EUC-JP charset */
 #define BFONT_CODE_SJIS         2   /**< \brief Shift-JIS charset */
 
+/* Defines to convert colors */
+#define MAKE_RGB555(c) (((c & 0xF80000)>>9)|((c & 0x00F800)>>6)|((c & 0x0000F8)>>3))
+#define MAKE_RGB565(c) (((c & 0xF80000)>>8)|((c & 0x00FC00)>>5)|((c & 0x0000F8)>>3))
+
+/* Set pixel mode - returns previous pixel mode */
+int bfont_set_pmode(int pmode);
+
+/* Set foreground color - returns previous color */
+uint32 bfont_set_fgcolor(uint32 color);
+
+/* Set background color - returns previous color */
+uint32 bfont_set_bgcolor(uint32 color);
+
 /** \brief  Set the font encoding.
 
     This function selects the font encoding that is used for the font. This
--- hardware/biosfont.c	2011-02-11 02:08:16.000000000 -0700
+++ hardware/biosfont-new.c	2011-02-25 16:32:37.413659311 -0700
@@ -21,11 +21,42 @@
 
 All the Japanese code is by Kazuaki Matsumoto.
 
+Foreground and background colors, and pixel mode support added by Chilly
+Willy.
+
 */
 
 /* Our current conversion mode */
 int bfont_code_mode = BFONT_CODE_ISO8859_1;
 
+/* Current foreground and background colors */
+uint32 bfont_fgcolor = 0xFFFFFF;
+uint32 bfont_bgcolor = 0x000000;
+
+/* Current pixel mode */
+int bfont_pmode = 1; /* video defaults to 565 */
+
+/* Set pixel mode - returns previous pixel mode */
+int bfont_set_pmode(int pmode) {
+    int old_pmode = bfont_pmode;
+    bfont_pmode = pmode;
+    return old_pmode;
+}
+
+/* Set foreground color - returns previous color */
+uint32 bfont_set_fgcolor(uint32 color) {
+    int old_color = bfont_fgcolor;
+    bfont_fgcolor = color;
+    return old_color;
+}
+
+/* Set background color - returns previous color */
+uint32 bfont_set_bgcolor(uint32 color) {
+    int old_color = bfont_bgcolor;
+    bfont_bgcolor = color;
+    return old_color;
+}
+
 /* Select an encoding for Japanese (or disable) */
 void bfont_set_encoding(int enc) {
 	if (enc < BFONT_CODE_ISO8859_1 || enc > BFONT_CODE_SJIS) {
@@ -142,15 +173,19 @@
 	else
 		ch = bfont_find_char(c);
 
+    if (bfont_pmode == 0 || bfont_pmode == 1) {
+        uint16 fc = bfont_pmode == 0 ? MAKE_RGB555(bfont_fgcolor) : MAKE_RGB565(bfont_fgcolor);
+        uint16 bc = bfont_pmode == 0 ? MAKE_RGB555(bfont_bgcolor) : MAKE_RGB565(bfont_bgcolor);
+
 	for (y=0; y<24; ) {
 		/* Do the first row */
 		word = (((uint16)ch[0]) << 4) | ((ch[1] >> 4) & 0x0f);
 		for (x=0; x<12; x++) {
 			if (word & (0x0800 >> x))
-				*buffer = 0xffff;
+                    *buffer = fc;
 			else {
 				if (opaque)
-					*buffer = 0x0000;
+                        *buffer = bc;
 			}
 			buffer++;
 		}
@@ -161,10 +196,10 @@
 		word = ( (((uint16)ch[1]) << 8) & 0xf00 ) | ch[2];
 		for (x=0; x<12; x++) {
 			if (word & (0x0800 >> x))
-				*buffer = 0xffff;
+                    *buffer = fc;
 			else {
 				if (opaque)
-					*buffer = 0x0000;
+                        *buffer = bc;
 			}
 			buffer++;
 		}
@@ -173,6 +208,40 @@
 
 		ch += 3;
 	}
+    } else {
+        uint32 *lbuffer = (uint32 *)buffer;
+        for (y=0; y<24; ) {
+            /* Do the first row */
+            word = (((uint16)ch[0]) << 4) | ((ch[1] >> 4) & 0x0f);
+            for (x=0; x<12; x++) {
+                if (word & (0x0800 >> x))
+                    *lbuffer = bfont_fgcolor;
+                else {
+                    if (opaque)
+                        *lbuffer = bfont_bgcolor;
+                }
+                lbuffer++;
+            }
+            lbuffer += bufwidth - 12;
+            y++;
+
+            /* Do the second row */
+            word = ( (((uint16)ch[1]) << 8) & 0xf00 ) | ch[2];
+            for (x=0; x<12; x++) {
+                if (word & (0x0800 >> x))
+                    *lbuffer = bfont_fgcolor;
+                else {
+                    if (opaque)
+                        *lbuffer = bfont_bgcolor;
+                }
+                lbuffer++;
+            }
+            lbuffer += bufwidth - 12;
+            y++;
+
+            ch += 3;
+        }
+    }
 }
 
 /* Compat function */
@@ -186,15 +255,19 @@
 	uint16	word;
 	int	x, y;
 
+    if (bfont_pmode == 0 || bfont_pmode == 1) {
+        uint16 fc = bfont_pmode == 0 ? MAKE_RGB555(bfont_fgcolor) : MAKE_RGB565(bfont_fgcolor);
+        uint16 bc = bfont_pmode == 0 ? MAKE_RGB555(bfont_bgcolor) : MAKE_RGB565(bfont_bgcolor);
+
 	for (y=0; y<24; ) {
 		/* Do the first row */
 		word = (((uint16)ch[0]) << 4) | ((ch[1] >> 4) & 0x0f);
 		for (x=0; x<12; x++) {
 			if (word & (0x0800 >> x))
-				*buffer = 0xffff;
+                    *buffer = fc;
 			else {
 				if (opaque)
-					*buffer = 0x0000;
+                        *buffer = bc;
 			}
 			buffer++;
 		}
@@ -202,10 +275,10 @@
 		word = ( (((uint16)ch[1]) << 8) & 0xf00 ) | ch[2];
 		for (x=0; x<12; x++) {
 			if (word & (0x0800 >> x))
-				*buffer = 0xffff;
+                    *buffer = fc;
 			else {
 				if (opaque)
-				*buffer = 0x0000;
+                        *buffer = bc;
 			}
 			buffer++;
 		}
@@ -214,6 +287,37 @@
 
 		ch += 3;
 	}
+    } else {
+        uint32 *lbuffer = (uint32 *)buffer;
+        for (y=0; y<24; ) {
+            /* Do the first row */
+            word = (((uint16)ch[0]) << 4) | ((ch[1] >> 4) & 0x0f);
+            for (x=0; x<12; x++) {
+                if (word & (0x0800 >> x))
+                    *lbuffer = bfont_fgcolor;
+                else {
+                    if (opaque)
+                        *lbuffer = bfont_bgcolor;
+                }
+                lbuffer++;
+            }
+
+            word = ( (((uint16)ch[1]) << 8) & 0xf00 ) | ch[2];
+            for (x=0; x<12; x++) {
+                if (word & (0x0800 >> x))
+                    *lbuffer = bfont_fgcolor;
+                else {
+                    if (opaque)
+                        *lbuffer = bfont_bgcolor;
+                }
+                lbuffer++;
+            }
+            lbuffer += bufwidth - 24;
+            y++;
+
+            ch += 3;
+        }
+    }
 }
 
 
@@ -250,14 +354,14 @@
 				str++;
 				nChr = (nChr << 8) | (*str & 0xff);
 				bfont_draw_wide(buffer, width, opaque, nChr);
-				buffer += 24;
+                buffer += bfont_pmode == 3 ? 48 : 24;
 			} else {
 				bfont_draw_thin(buffer, width, opaque, nChr, 1);
-				buffer += 12;
+                buffer += bfont_pmode == 3 ? 24 : 12;
 			}
 		} else {
 			bfont_draw_thin(buffer, width, opaque, nChr, 0);
-			buffer += 12;
+            buffer += bfont_pmode == 3 ? 24 : 12;
 		}
 		str++;
 	}
