Some fixes and cleanups after latest changes.

- Fixed Cirrus text mode output.
- VBE now using it's own 'line_offset' value.
- Since font change is now handled in update(), removing gui method set_text_charbyte().
This commit is contained in:
Volker Ruppert 2024-02-09 14:34:01 +01:00
parent e53cf3b962
commit e5ff346368
5 changed files with 19 additions and 30 deletions

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002-2023 The Bochs Project
// Copyright (C) 2002-2024 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -914,13 +914,6 @@ void bx_gui_c::set_text_charmap(Bit8u map, Bit8u *fbuffer)
BX_GUI_THIS charmap_updated = 1;
}
void bx_gui_c::set_text_charbyte(Bit8u map, Bit16u address, Bit8u data)
{
BX_GUI_THIS vga_charmap[map][address] = data;
BX_GUI_THIS char_changed[map][address >> 5] = 1;
BX_GUI_THIS charmap_updated = 1;
}
void bx_gui_c::beep_on(float frequency)
{
BX_DEBUG(("GUI Beep ON (frequency=%.2f)", frequency));

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002-2023 The Bochs Project
// Copyright (C) 2002-2024 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -172,7 +172,6 @@ public:
// GUI code calls them
static void key_event(Bit32u key);
static void set_text_charmap(Bit8u map, Bit8u *fbuffer);
static void set_text_charbyte(Bit8u map, Bit16u address, Bit8u data);
static Bit8u get_mouse_headerbar_id();
void init(int argc, char **argv, unsigned max_xres, unsigned max_yres,

View File

@ -1208,7 +1208,7 @@ void bx_svga_cirrus_c::update(void)
}
if ((BX_CIRRUS_THIS sequencer.reg[0x07] & 0x01) == CIRRUS_SR7_BPP_VGA) {
if (BX_CIRRUS_THIS svga_needs_update_mode) {
BX_CIRRUS_THIS s.vga_mem_updated = 1;
BX_CIRRUS_THIS s.vga_mem_updated = 0x0f;
BX_CIRRUS_THIS svga_needs_update_mode = 0;
}
BX_CIRRUS_THIS bx_vgacore_c::update();

View File

@ -201,7 +201,7 @@ void bx_vga_c::register_state(void)
new bx_shadow_num_c(vbe, "virtual_yres", &BX_VGA_THIS vbe.virtual_yres);
new bx_shadow_num_c(vbe, "virtual_start", &BX_VGA_THIS vbe.virtual_start);
new bx_shadow_num_c(vbe, "bpp_multiplier", &BX_VGA_THIS vbe.bpp_multiplier);
new bx_shadow_num_c(vbe, "saved_line_offset", &BX_VGA_THIS vbe.saved_line_offset);
new bx_shadow_num_c(vbe, "line_offset", &BX_VGA_THIS vbe.line_offset);
BXRS_PARAM_BOOL(vbe, get_capabilities, BX_VGA_THIS vbe.get_capabilities);
BXRS_PARAM_BOOL(vbe, dac_8bit, BX_VGA_THIS vbe.dac_8bit);
BXRS_PARAM_BOOL(vbe, ddc_enabled, BX_VGA_THIS vbe.ddc_enabled);
@ -328,7 +328,7 @@ void bx_vga_c::update(void)
iWidth = BX_VGA_THIS vbe.xres;
iHeight = BX_VGA_THIS vbe.yres;
pitch = BX_VGA_THIS s.line_offset;
pitch = BX_VGA_THIS vbe.line_offset;
Bit8u *disp_ptr = &BX_VGA_THIS s.memory[BX_VGA_THIS vbe.virtual_start];
if (bx_gui->graphics_tile_info_common(&info)) {
@ -606,7 +606,7 @@ void bx_vga_c::update(void)
for (r=0; r<Y_TILESIZE; r++) {
y = yc + r;
if (BX_VGA_THIS s.y_doublescan) y >>= 1;
row_addr = BX_VGA_THIS vbe.virtual_start + (y * BX_VGA_THIS s.line_offset);
row_addr = BX_VGA_THIS vbe.virtual_start + (y * BX_VGA_THIS vbe.line_offset);
for (c=0; c<X_TILESIZE; c++) {
x = xc + c;
BX_VGA_THIS s.tile[r*X_TILESIZE + c] =
@ -1079,8 +1079,6 @@ Bit32u bx_vga_c::vbe_write(Bit32u address, Bit32u value, unsigned io_len)
{
unsigned depth=0;
BX_VGA_THIS vbe.saved_line_offset = BX_VGA_THIS s.line_offset;
// setup virtual resolution to be the same as current reso
BX_VGA_THIS vbe.virtual_yres=BX_VGA_THIS vbe.yres;
BX_VGA_THIS vbe.virtual_xres=BX_VGA_THIS vbe.xres;
@ -1095,41 +1093,41 @@ Bit32u bx_vga_c::vbe_write(Bit32u address, Bit32u value, unsigned io_len)
// Default pixel sizes
case VBE_DISPI_BPP_8:
BX_VGA_THIS vbe.bpp_multiplier = 1;
BX_VGA_THIS s.line_offset = BX_VGA_THIS vbe.virtual_xres;
BX_VGA_THIS vbe.line_offset = BX_VGA_THIS vbe.virtual_xres;
depth=8;
break;
case VBE_DISPI_BPP_4:
BX_VGA_THIS vbe.bpp_multiplier = 1;
BX_VGA_THIS s.line_offset = (BX_VGA_THIS vbe.virtual_xres >> 3);
BX_VGA_THIS vbe.line_offset = (BX_VGA_THIS vbe.virtual_xres >> 3);
depth=4;
break;
case VBE_DISPI_BPP_15:
BX_VGA_THIS vbe.bpp_multiplier = 2;
BX_VGA_THIS s.line_offset = BX_VGA_THIS vbe.virtual_xres * 2;
BX_VGA_THIS vbe.line_offset = BX_VGA_THIS vbe.virtual_xres * 2;
depth=15;
break;
case VBE_DISPI_BPP_16:
BX_VGA_THIS vbe.bpp_multiplier = 2;
BX_VGA_THIS s.line_offset = BX_VGA_THIS vbe.virtual_xres * 2;
BX_VGA_THIS vbe.line_offset = BX_VGA_THIS vbe.virtual_xres * 2;
depth=16;
break;
case VBE_DISPI_BPP_24:
BX_VGA_THIS vbe.bpp_multiplier = 3;
BX_VGA_THIS s.line_offset = BX_VGA_THIS vbe.virtual_xres * 3;
BX_VGA_THIS vbe.line_offset = BX_VGA_THIS vbe.virtual_xres * 3;
depth=24;
break;
case VBE_DISPI_BPP_32:
BX_VGA_THIS vbe.bpp_multiplier = 4;
BX_VGA_THIS s.line_offset = BX_VGA_THIS vbe.virtual_xres << 2;
BX_VGA_THIS vbe.line_offset = BX_VGA_THIS vbe.virtual_xres << 2;
depth=32;
break;
}
BX_VGA_THIS vbe.visible_screen_size = BX_VGA_THIS s.line_offset * BX_VGA_THIS vbe.yres;
BX_VGA_THIS vbe.visible_screen_size = BX_VGA_THIS vbe.line_offset * BX_VGA_THIS vbe.yres;
BX_INFO(("VBE enabling x %d, y %d, bpp %d, %u bytes visible", BX_VGA_THIS vbe.xres, BX_VGA_THIS vbe.yres, BX_VGA_THIS vbe.bpp, BX_VGA_THIS vbe.visible_screen_size));
@ -1146,7 +1144,6 @@ Bit32u bx_vga_c::vbe_write(Bit32u address, Bit32u value, unsigned io_len)
}
} else if (((value & VBE_DISPI_ENABLED) == 0) && BX_VGA_THIS vbe.enabled) {
BX_INFO(("VBE disabling"));
BX_VGA_THIS s.line_offset = BX_VGA_THIS vbe.saved_line_offset;
BX_VGA_THIS s.plane_shift = 16;
BX_VGA_THIS s.ext_offset = 0;
}
@ -1203,7 +1200,7 @@ Bit32u bx_vga_c::vbe_write(Bit32u address, Bit32u value, unsigned io_len)
BX_DEBUG(("VBE offset x %d", value));
BX_VGA_THIS vbe.offset_x=(Bit16u)value;
BX_VGA_THIS vbe.virtual_start = BX_VGA_THIS vbe.offset_y * BX_VGA_THIS s.line_offset;
BX_VGA_THIS vbe.virtual_start = BX_VGA_THIS vbe.offset_y * BX_VGA_THIS vbe.line_offset;
if (BX_VGA_THIS vbe.bpp != VBE_DISPI_BPP_4) {
BX_VGA_THIS vbe.virtual_start += (BX_VGA_THIS vbe.offset_x * BX_VGA_THIS vbe.bpp_multiplier);
} else {
@ -1216,7 +1213,7 @@ Bit32u bx_vga_c::vbe_write(Bit32u address, Bit32u value, unsigned io_len)
{
BX_DEBUG(("VBE offset y %d", value));
Bit32u new_screen_start = value * BX_VGA_THIS s.line_offset;
Bit32u new_screen_start = value * BX_VGA_THIS vbe.line_offset;
if (BX_VGA_THIS vbe.bpp != VBE_DISPI_BPP_4) {
if ((new_screen_start + BX_VGA_THIS vbe.visible_screen_size) > VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES)
{
@ -1282,11 +1279,11 @@ Bit32u bx_vga_c::vbe_write(Bit32u address, Bit32u value, unsigned io_len)
BX_VGA_THIS vbe.virtual_xres=new_width;
BX_VGA_THIS vbe.virtual_yres=new_height;
if (BX_VGA_THIS vbe.bpp != VBE_DISPI_BPP_4) {
BX_VGA_THIS s.line_offset = BX_VGA_THIS vbe.virtual_xres * BX_VGA_THIS vbe.bpp_multiplier;
BX_VGA_THIS vbe.line_offset = BX_VGA_THIS vbe.virtual_xres * BX_VGA_THIS vbe.bpp_multiplier;
} else {
BX_VGA_THIS s.line_offset = BX_VGA_THIS vbe.virtual_xres >> 3;
BX_VGA_THIS vbe.line_offset = BX_VGA_THIS vbe.virtual_xres >> 3;
}
BX_VGA_THIS vbe.visible_screen_size = BX_VGA_THIS s.line_offset * BX_VGA_THIS vbe.yres;
BX_VGA_THIS vbe.visible_screen_size = BX_VGA_THIS vbe.line_offset * BX_VGA_THIS vbe.yres;
} break;
case VBE_DISPI_INDEX_VIRT_HEIGHT:

View File

@ -162,7 +162,7 @@ private:
Bit16u virtual_yres;
Bit32u virtual_start; /**< For dealing with bpp>8, this is where the virtual screen starts. */
Bit8u bpp_multiplier; /**< We have to save this b/c sometimes we need to recalculate stuff with it. */
Bit16u saved_line_offset;
Bit16u line_offset;
bool get_capabilities;
bool dac_8bit;
bool ddc_enabled;