Modified VGA extension init method. Now it returns 1 if the extension code has

initialized the VGA compatible video memory. If it has returned 0 the VGA core
code sets up the default VGA memory (256k).
This commit is contained in:
Volker Ruppert 2017-10-12 19:18:23 +00:00
parent d25e85c21a
commit 5ec78eaae2
6 changed files with 19 additions and 22 deletions

View File

@ -252,7 +252,7 @@ bx_svga_cirrus_c::~bx_svga_cirrus_c()
BX_DEBUG(("Exit"));
}
void bx_svga_cirrus_c::init_vga_extension(void)
bx_bool bx_svga_cirrus_c::init_vga_extension(void)
{
BX_CIRRUS_THIS put("CIRRUS");
// initialize SVGA stuffs.
@ -272,11 +272,11 @@ void bx_svga_cirrus_c::init_vga_extension(void)
}
BX_CIRRUS_THIS s.max_xres = 1600;
BX_CIRRUS_THIS s.max_yres = 1200;
BX_CIRRUS_THIS extension_init = 1;
#if BX_DEBUGGER
// register device for the 'info device' command (calls debug_dump())
bx_dbg_register_debug_info("cirrus", this);
#endif
return 1;
}
void bx_svga_cirrus_c::svga_init_members()

View File

@ -68,7 +68,7 @@ public:
bx_svga_cirrus_c();
virtual ~bx_svga_cirrus_c();
virtual void init_vga_extension(void);
virtual bx_bool init_vga_extension(void);
virtual void reset(unsigned type);
virtual void redraw_area(unsigned x0, unsigned y0,
unsigned width, unsigned height);

View File

@ -86,10 +86,11 @@ bx_vga_c::~bx_vga_c()
BX_DEBUG(("Exit"));
}
void bx_vga_c::init_vga_extension(void)
bx_bool bx_vga_c::init_vga_extension(void)
{
unsigned addr;
Bit16u max_xres, max_yres, max_bpp;
bx_bool ret = 0;
BX_VGA_THIS init_iohandlers(read_handler, write_handler);
BX_VGA_THIS pci_enabled = SIM->is_pci_device("pcivga");
@ -148,7 +149,7 @@ void bx_vga_c::init_vga_extension(void)
BX_VGA_THIS s.max_xres = BX_VGA_THIS vbe.max_xres;
BX_VGA_THIS s.max_yres = BX_VGA_THIS vbe.max_yres;
BX_VGA_THIS vbe_present = 1;
BX_VGA_THIS extension_init = 1;
ret = 1;
BX_INFO(("VBE Bochs Display Extension Enabled"));
}
@ -176,6 +177,7 @@ void bx_vga_c::init_vga_extension(void)
// register device for the 'info device' command (calls debug_dump())
bx_dbg_register_debug_info("vga", this);
#endif
return ret;
}
void bx_vga_c::reset(unsigned type)

View File

@ -104,7 +104,7 @@ public:
virtual void redraw_area(unsigned x0, unsigned y0,
unsigned width, unsigned height);
virtual void init_vga_extension(void);
virtual bx_bool init_vga_extension(void);
#if BX_SUPPORT_PCI
virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len);

View File

@ -101,11 +101,16 @@ void bx_vgacore_c::init(void)
unsigned x,y;
BX_VGA_THIS vgaext = SIM->get_param_string(BXPN_VGA_EXTENSION);
BX_VGA_THIS extension_init = 0;
BX_VGA_THIS pci_enabled = 0;
BX_VGA_THIS init_standard_vga();
BX_VGA_THIS init_vga_extension();
if (!BX_VGA_THIS init_vga_extension()) {
// VGA memory not yet initialized
BX_VGA_THIS s.memsize = 0x40000;
if (BX_VGA_THIS s.memory == NULL)
BX_VGA_THIS s.memory = new Bit8u[BX_VGA_THIS s.memsize];
memset(BX_VGA_THIS s.memory, 0, BX_VGA_THIS s.memsize);
}
BX_VGA_THIS init_gui();
BX_VGA_THIS s.num_x_tiles = BX_VGA_THIS s.max_xres / X_TILESIZE +
@ -117,9 +122,6 @@ void bx_vgacore_c::init(void)
for (x = 0; x < BX_VGA_THIS s.num_x_tiles; x++)
SET_TILE_UPDATED(x, y, 0);
if (!BX_VGA_THIS extension_init && !BX_VGA_THIS vgaext->isempty()) {
BX_PANIC(("unknown display extension: %s", BX_VGA_THIS vgaext->getptr()));
}
if (!BX_VGA_THIS pci_enabled) {
BX_MEM(0)->load_ROM(SIM->get_param_string(BXPN_VGA_ROM_PATH)->getptr(), 0xc0000, 1);
}
@ -161,20 +163,14 @@ void bx_vgacore_c::init_standard_vga(void)
BX_VGA_THIS s.vga_override = 0;
// initialize memory, handlers and timer (depending on extension)
if (BX_VGA_THIS vgaext->isempty()) {
BX_VGA_THIS s.memsize = 0x40000;
if (BX_VGA_THIS s.memory == NULL)
BX_VGA_THIS s.memory = new Bit8u[BX_VGA_THIS s.memsize];
memset(BX_VGA_THIS s.memory, 0, BX_VGA_THIS s.memsize);
}
// initialize memory handlers, timer and CMOS
DEV_register_memory_handlers(BX_VGA_THIS_PTR, mem_read_handler, mem_write_handler,
0xa0000, 0xbffff);
BX_VGA_THIS init_systemtimer();
// video card with BIOS ROM
DEV_cmos_set_reg(0x14, (DEV_cmos_get_reg(0x14) & 0xcf) | 0x00);
BX_VGA_THIS init_systemtimer();
}
void bx_vgacore_c::init_gui(void)

View File

@ -79,7 +79,7 @@ public:
virtual void refresh_display(void *this_ptr, bx_bool redraw);
virtual void get_text_snapshot(Bit8u **text_snapshot, unsigned *txHeight,
unsigned *txWidth);
virtual void init_vga_extension(void) {}
virtual bx_bool init_vga_extension(void) {return 0;}
static void vga_timer_handler(void *);
static Bit64s vga_param_handler(bx_param_c *param, int set, Bit64s val);
@ -243,7 +243,6 @@ protected:
int timer_id;
bx_bool realtime;
bx_param_string_c *vgaext;
bx_bool extension_init;
bx_bool pci_enabled;
};