Index: /trunk/src/VBox/Devices/Graphics/BIOS/inlines.h
===================================================================
--- /trunk/src/VBox/Devices/Graphics/BIOS/inlines.h	(revision 83001)
+++ /trunk/src/VBox/Devices/Graphics/BIOS/inlines.h	(revision 83002)
@@ -133,8 +133,6 @@
     parm [dx ax] value [dx ax] modify exact [dx ax] nomemory;
 
-//@todo: Do CLD elsewhere!
 extern void memsetb(uint16_t seg, uint16_t offset, uint16_t value, uint16_t count);
 #pragma aux memsetb =   \
-    "cld"               \
     "jcxz no_copy"      \
     "rep stosb"         \
@@ -142,8 +140,6 @@
     parm [es] [di] [ax] [cx];
 
-//@todo: Do CLD elsewhere!
 extern void memsetw(uint16_t seg, uint16_t offset, uint16_t value, uint16_t count);
 #pragma aux memsetw =   \
-    "cld"               \
     "jcxz no_copy"      \
     "rep stosw"         \
@@ -151,8 +147,6 @@
     parm [es] [di] [ax] [cx];
 
-//@todo: Do CLD elsewhere!
 extern void memcpyb(uint16_t dseg, uint16_t doffset, uint16_t sseg, uint16_t soffset, uint16_t count);
 #pragma aux memcpyb =   \
-    "cld"               \
     "jcxz   no_copy"    \
     "push   ds"         \
@@ -163,8 +157,6 @@
     parm [es] [di] [dx] [si] [cx];
 
-//@todo: Do CLD elsewhere!
 extern void memcpyw(uint16_t dseg, uint16_t doffset, uint16_t sseg, uint16_t soffset, uint16_t count);
 #pragma aux memcpyw =   \
-    "cld"               \
     "jcxz   no_copy"    \
     "push   ds"         \
Index: /trunk/src/VBox/Devices/Graphics/BIOS/vberom.asm
===================================================================
--- /trunk/src/VBox/Devices/Graphics/BIOS/vberom.asm	(revision 83001)
+++ /trunk/src/VBox/Devices/Graphics/BIOS/vberom.asm	(revision 83002)
@@ -780,6 +780,6 @@
   test bl, bl
   jnz _fail
-  mov di, 0C000h
-  mov es, di
+  push cs
+  pop es
   mov di, offset vesa_pm_start
   mov cx, vesa_pm_end - vesa_pm_start
Index: /trunk/src/VBox/Devices/Graphics/BIOS/vgabios.c
===================================================================
--- /trunk/src/VBox/Devices/Graphics/BIOS/vgabios.c	(revision 83001)
+++ /trunk/src/VBox/Devices/Graphics/BIOS/vgabios.c	(revision 83002)
@@ -77,6 +77,7 @@
 
 static uint8_t find_vga_entry();
-
-extern uint8_t xread_byte(uint16_t seg, uint16_t offset);
+static void biosfn_load_text_8_16_pat(uint8_t AL, uint8_t BL);
+
+extern uint8_t readx_byte(uint16_t seg, uint16_t offset);
 
 #ifdef VBE
@@ -85,9 +86,9 @@
 #endif
 
-void set_int_vector(uint8_t int_vec, void *offset)
+void set_int_vector(uint8_t int_vec, void __far *ptr)
 {
     void __far * __far *ivt = 0;
 
-    ivt[int_vec] = 0xC000 :> offset;
+    ivt[int_vec] = ptr;
 }
 
@@ -573,20 +574,20 @@
         break;
     case 0x02:
-        ptr = 0xC000 :> vgafont14;
+        ptr = vgafont14;
         break;
     case 0x03:
-        ptr = 0xC000 :> vgafont8;
+        ptr = vgafont8;
         break;
     case 0x04:
-        ptr = 0xC000 :> (vgafont8 + 128 * 8);
+        ptr = vgafont8 + 128 * 8;
         break;
     case 0x05:
-        ptr = 0xC000 :> vgafont14alt;
+        ptr = vgafont14alt;
         break;
     case 0x06:
-        ptr = 0xC000 :> vgafont16;
+        ptr = vgafont16;
         break;
     case 0x07:
-        ptr = 0xC000 :> vgafont16alt;
+        ptr = vgafont16alt;
         break;
     default:
@@ -878,7 +879,8 @@
  // Should we clear the screen ?
  uint8_t  noclearmem=mode&0x80;
- uint8_t  line,mmask,*palette,vpti;
- uint16_t i,twidth,theightm1,cheight;
- uint8_t  modeset_ctl,video_ctl,vga_switches;
+ uint8_t  line,mmask,vpti;
+ uint8_t  modeset_ctl;
+ uint8_t  *palette;
+ uint16_t i;
  uint16_t crtc_addr;
 
@@ -910,8 +912,6 @@
 
  vpti=line_to_vpti[line];
- twidth=video_param_table[vpti].twidth;
- theightm1=video_param_table[vpti].theightm1;
- cheight=video_param_table[vpti].cheight;
-
+
+#if 0   // These are unused, but perhaps they shouldn't be?
  // Read the bios vga control
  video_ctl=read_byte(BIOSMEM_SEG,BIOSMEM_VIDEO_CTL);
@@ -919,4 +919,5 @@
  // Read the bios vga switches
  vga_switches=read_byte(BIOSMEM_SEG,BIOSMEM_SWITCHES);
+#endif
 
  // Read the bios mode set control
@@ -1036,9 +1037,9 @@
  // Set the BIOS mem
  write_byte(BIOSMEM_SEG,BIOSMEM_CURRENT_MODE,mode);
- write_word(BIOSMEM_SEG,BIOSMEM_NB_COLS,twidth);
+ write_word(BIOSMEM_SEG,BIOSMEM_NB_COLS,video_param_table[vpti].twidth);
  write_word(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE,video_param_table[vpti].slength);
  write_word(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS,crtc_addr);
- write_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS,theightm1);
- write_word(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT,cheight);
+ write_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS,video_param_table[vpti].theightm1);
+ write_word(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT,video_param_table[vpti].cheight);
  write_byte(BIOSMEM_SEG,BIOSMEM_VIDEO_CTL,(0x60|noclearmem));
  write_byte(BIOSMEM_SEG,BIOSMEM_SWITCHES,0xF9);
@@ -1078,5 +1079,5 @@
  set_int_vector(0x1f, vgafont8+128*8);
 
-  switch(cheight)
+  switch(video_param_table[vpti].cheight)
    {case 8:
      set_int_vector(0x43, vgafont8);
@@ -1394,5 +1395,5 @@
      mask=0x80>>j;
      outw(VGAREG_GRDC_ADDRESS, (mask << 8) | 0x08);
-     xread_byte(0xa000,dest);
+     readx_byte(0xa000,dest);
      if(fdata[src+i]&mask)
       {
@@ -1641,5 +1642,5 @@
      outw(VGAREG_GRDC_ADDRESS, (mask << 8) | 0x08);
      outw(VGAREG_GRDC_ADDRESS, 0x0205);
-     data = xread_byte(0xa000,addr);
+     data = readx_byte(0xa000,addr);
      if (AL & 0x80)
       {
@@ -2332,5 +2333,5 @@
  * may be corrupted.
  */
-uint8_t xread_byte(uint16_t seg, uint16_t offset)
+uint8_t readx_byte(uint16_t seg, uint16_t offset)
 {
     return( *(seg:>(uint8_t *)offset) );
@@ -2548,5 +2549,5 @@
         if (GET_AL() < 2) {
             write_byte(BIOSMEM_SEG,BIOSMEM_VIDEO_CTL,
-              (xread_byte(BIOSMEM_SEG,BIOSMEM_VIDEO_CTL) & ~1) | GET_AL());
+              (read_byte(BIOSMEM_SEG,BIOSMEM_VIDEO_CTL) & ~1) | GET_AL());
             SET_AL(0x12);
         }
Index: /trunk/src/VBox/Devices/Graphics/BIOS/vgarom.asm
===================================================================
--- /trunk/src/VBox/Devices/Graphics/BIOS/vgarom.asm	(revision 83001)
+++ /trunk/src/VBox/Devices/Graphics/BIOS/vgarom.asm	(revision 83002)
@@ -87,6 +87,7 @@
   push ds
   DO_pusha
-  mov   bx, 0C000h
-  mov   ds, bx
+  push  cs
+  pop   ds
+  cld
   call _int10_debugmsg
   DO_popa
@@ -197,6 +198,7 @@
 
 ;; We have to set ds to access the right data segment
-  mov   bx, 0C000h
-  mov   ds, bx
+  push  cs
+  pop   ds
+  cld
   call _int10_func
 
