- forward changes of the active charmap to the gui with the new function

set_text_charbyte()
- vga: store the address of the active charmap in the new variable
  charmap_address
- vga: text mode hack removed. The write modes, operations and masks must be
  used in text mode too.
- sdl: clear_screen() is not necessary when the charmap has changed
- win32: update only the changed font bitmaps before drawing the text
This commit is contained in:
Volker Ruppert 2002-09-19 18:59:50 +00:00
parent d8c27b4f83
commit 721f89b77b
6 changed files with 30 additions and 20 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: gui.cc,v 1.46 2002-09-08 07:56:09 vruppert Exp $
// $Id: gui.cc,v 1.47 2002-09-19 18:59:49 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -485,5 +485,12 @@ bx_gui_c::init_signal_handlers ()
bx_gui_c::set_text_charmap(Bit8u *fbuffer)
{
memcpy(& BX_GUI_THIS vga_charmap, fbuffer, 0x2000);
BX_GUI_THIS charmap_changed = 1;
for (unsigned i=0; i<256; i++) BX_GUI_THIS charmap_changed[i] = 1;
}
void
bx_gui_c::set_text_charbyte(Bit16u address, Bit8u data)
{
BX_GUI_THIS vga_charmap[address] = data;
BX_GUI_THIS charmap_changed[address >> 5] = 1;
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: gui.h,v 1.29 2002-09-08 07:56:09 vruppert Exp $
// $Id: gui.h,v 1.30 2002-09-19 18:59:49 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -49,6 +49,7 @@ public:
static int get_clipboard_text(Bit8u **bytes, Bit32s *nbytes);
static int set_clipboard_text(char *snapshot, Bit32u len);
static void set_text_charmap(Bit8u *fbuffer);
static void set_text_charbyte(Bit16u address, Bit8u data);
// The following function(s) are defined already, and your
// GUI code calls them
@ -103,7 +104,7 @@ private:
unsigned user_bmap_id, user_hbar_id;
unsigned char vga_charmap[0x2000];
Boolean charmap_changed;
Boolean charmap_changed[256];
};

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: sdl.cc,v 1.19 2002-09-08 07:56:09 vruppert Exp $
// $Id: sdl.cc,v 1.20 2002-09-19 18:59:49 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -590,8 +590,6 @@ void bx_gui_c::dimension_update(
if( fheight > 0 )
{
if (bx_gui.charmap_changed) bx_gui.clear_screen();
bx_gui.charmap_changed = 0;
fontheight = fheight;
fontwidth = 8;
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: win32.cc,v 1.40 2002-09-08 16:41:19 vruppert Exp $
// $Id: win32.cc,v 1.41 2002-09-19 18:59:50 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -784,14 +784,14 @@ void bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
unsigned nchars, ncols;
unsigned char data[64];
if (bx_gui.charmap_changed) {
for (unsigned c = 0; c<256; c++) {
for (unsigned c = 0; c<256; c++) {
if (bx_gui.charmap_changed[c]) {
memset(data, 0, sizeof(data));
for (unsigned i=0; i<32; i++)
data[i*2] = bx_gui.vga_charmap[c*32+i];
SetBitmapBits(vgafont[c], 64, data);
bx_gui.charmap_changed[c] = 0;
}
bx_gui.charmap_changed = 0;
}
cs_start = (cursor_state >> 8) & 0x3f;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: vga.cc,v 1.40 2002-09-13 00:11:49 cbothamy Exp $
// $Id: vga.cc,v 1.41 2002-09-19 18:59:50 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -201,6 +201,8 @@ bx_vga_c::init(bx_devices_c *d, bx_cmos_c *cmos)
BX_VGA_THIS s.horiz_tick = 0;
BX_VGA_THIS s.vert_tick = 0;
BX_VGA_THIS s.charmap_address = 0;
#if BX_SUPPORT_VBE
// The following is for the vbe display extension
@ -939,8 +941,9 @@ BX_VGA_THIS s.sequencer.bit1 = (value >> 1) & 0x01;
charmap2 = (value & 0x2C) >> 2;
if (charmap2 > 3) charmap2 = (charmap2 & 3) + 4;
if (BX_VGA_THIS s.CRTC.reg[0x09] > 0) {
BX_VGA_THIS s.charmap_address = (charmap1 << 13);
bx_gui.set_text_charmap(
& BX_VGA_THIS s.vga_memory[0x20000 + (charmap1 << 13)]);
& BX_VGA_THIS s.vga_memory[0x20000 + BX_VGA_THIS s.charmap_address]);
}
if (charmap2 != charmap1)
BX_INFO(("char map select: #2=%d (unused)", charmap2));
@ -1815,11 +1818,6 @@ bx_vga_c::mem_write(Bit32u addr, Bit8u value)
default: // 0xA0000 .. 0xBFFFF
offset = addr - 0xA0000;
}
if (BX_VGA_THIS s.graphics_ctrl.memory_mapping != 1) {
BX_VGA_THIS s.vga_memory[offset] = value;
BX_VGA_THIS s.vga_mem_updated = 1;
return;
}
}
/* addr between 0xA0000 and 0xAFFFF */
@ -1998,8 +1996,13 @@ bx_vga_c::mem_write(Bit32u addr, Bit8u value)
BX_VGA_THIS s.vga_memory[0*65536 + offset] = new_val[0];
if (BX_VGA_THIS s.sequencer.map_mask_bit[1])
BX_VGA_THIS s.vga_memory[1*65536 + offset] = new_val[1];
if (BX_VGA_THIS s.sequencer.map_mask_bit[2])
if (BX_VGA_THIS s.sequencer.map_mask_bit[2]) {
if ((!BX_VGA_THIS s.graphics_ctrl.graphics_alpha) &&
((offset & 0xe000) == BX_VGA_THIS s.charmap_address)) {
bx_gui.set_text_charbyte((offset & 0x1fff), new_val[2]);
}
BX_VGA_THIS s.vga_memory[2*65536 + offset] = new_val[2];
}
if (BX_VGA_THIS s.sequencer.map_mask_bit[3])
BX_VGA_THIS s.vga_memory[3*65536 + offset] = new_val[3];

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: vga.h,v 1.15 2002-09-19 01:32:38 bdenney Exp $
// $Id: vga.h,v 1.16 2002-09-19 18:59:50 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -224,6 +224,7 @@ private:
unsigned vert_tick;
Bit8u rgb[3 * 256];
Bit8u tile[X_TILESIZE * Y_TILESIZE];
Bit16u charmap_address;
#if BX_SUPPORT_VBE
Bit8u vbe_memory[VBE_DISPI_TOTAL_VIDEO_MEMORY_MB *1024 * 1024];