- changed the maximum x/y resolution and the resulting number of x/y tiles
from constant to variable
This commit is contained in:
parent
a34cf1bcd5
commit
709dc30cf4
@ -45,17 +45,18 @@
|
|||||||
|
|
||||||
// Only reference the array if the tile numbers are within the bounds
|
// Only reference the array if the tile numbers are within the bounds
|
||||||
// of the array. If out of bounds, do nothing.
|
// of the array. If out of bounds, do nothing.
|
||||||
#define SET_TILE_UPDATED(xtile,ytile,value) \
|
#define SET_TILE_UPDATED(xtile, ytile, value) \
|
||||||
do { \
|
do { \
|
||||||
if (((xtile) < BX_NUM_X_TILES) && ((ytile) < BX_NUM_Y_TILES)) \
|
if (((xtile) < BX_CIRRUS_THIS s.num_x_tiles) && ((ytile) < BX_CIRRUS_THIS s.num_y_tiles)) \
|
||||||
BX_CIRRUS_THIS s.vga_tile_updated[(xtile)][(ytile)] = value; \
|
BX_CIRRUS_THIS s.vga_tile_updated[(xtile)+(ytile)*BX_CIRRUS_THIS s.num_x_tiles] = value; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
// Only reference the array if the tile numbers are within the bounds
|
// Only reference the array if the tile numbers are within the bounds
|
||||||
// of the array. If out of bounds, return 1.
|
// of the array. If out of bounds, return 0.
|
||||||
#define GET_TILE_UPDATED(xtile,ytile) \
|
#define GET_TILE_UPDATED(xtile,ytile) \
|
||||||
((((xtile) < BX_NUM_X_TILES) && ((ytile) < BX_NUM_Y_TILES))? \
|
((((xtile) < BX_CIRRUS_THIS s.num_x_tiles) && ((ytile) < BX_CIRRUS_THIS s.num_y_tiles))? \
|
||||||
BX_CIRRUS_THIS s.vga_tile_updated[(xtile)][(ytile)] \
|
BX_CIRRUS_THIS s.vga_tile_updated[(xtile)+(ytile)*BX_CIRRUS_THIS s.num_x_tiles] \
|
||||||
: 1)
|
: 0)
|
||||||
|
|
||||||
#define LOG_THIS BX_CIRRUS_THIS
|
#define LOG_THIS BX_CIRRUS_THIS
|
||||||
|
|
||||||
@ -270,6 +271,8 @@ void bx_svga_cirrus_c::init_vga_extension(void)
|
|||||||
{
|
{
|
||||||
BX_INFO(("CL-GD5430 ISA initialized"));
|
BX_INFO(("CL-GD5430 ISA initialized"));
|
||||||
}
|
}
|
||||||
|
BX_CIRRUS_THIS s.max_xres = 1600;
|
||||||
|
BX_CIRRUS_THIS s.max_yres = 1200;
|
||||||
BX_CIRRUS_THIS extension_init = 1;
|
BX_CIRRUS_THIS extension_init = 1;
|
||||||
} else {
|
} else {
|
||||||
BX_CIRRUS_THIS sequencer.reg[0x07] = 0x00; // Cirrus extension disabled
|
BX_CIRRUS_THIS sequencer.reg[0x07] = 0x00; // Cirrus extension disabled
|
||||||
|
@ -38,15 +38,15 @@
|
|||||||
// of the array. If out of bounds, do nothing.
|
// of the array. If out of bounds, do nothing.
|
||||||
#define SET_TILE_UPDATED(xtile, ytile, value) \
|
#define SET_TILE_UPDATED(xtile, ytile, value) \
|
||||||
do { \
|
do { \
|
||||||
if (((xtile) < BX_NUM_X_TILES) && ((ytile) < BX_NUM_Y_TILES)) \
|
if (((xtile) < BX_VGA_THIS s.num_x_tiles) && ((ytile) < BX_VGA_THIS s.num_y_tiles)) \
|
||||||
BX_VGA_THIS s.vga_tile_updated[(xtile)][(ytile)] = value; \
|
BX_VGA_THIS s.vga_tile_updated[(xtile)+(ytile)*BX_VGA_THIS s.num_x_tiles] = value; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
// Only reference the array if the tile numbers are within the bounds
|
// Only reference the array if the tile numbers are within the bounds
|
||||||
// of the array. If out of bounds, return 0.
|
// of the array. If out of bounds, return 0.
|
||||||
#define GET_TILE_UPDATED(xtile,ytile) \
|
#define GET_TILE_UPDATED(xtile,ytile) \
|
||||||
((((xtile) < BX_NUM_X_TILES) && ((ytile) < BX_NUM_Y_TILES))? \
|
((((xtile) < BX_VGA_THIS s.num_x_tiles) && ((ytile) < BX_VGA_THIS s.num_y_tiles))? \
|
||||||
BX_VGA_THIS s.vga_tile_updated[(xtile)][(ytile)] \
|
BX_VGA_THIS s.vga_tile_updated[(xtile)+(ytile)*BX_VGA_THIS s.num_x_tiles] \
|
||||||
: 0)
|
: 0)
|
||||||
|
|
||||||
static const Bit16u charmap_offset[8] = {
|
static const Bit16u charmap_offset[8] = {
|
||||||
@ -105,8 +105,7 @@ bx_vga_c::bx_vga_c()
|
|||||||
{
|
{
|
||||||
put("VGA");
|
put("VGA");
|
||||||
s.vga_mem_updated = 0;
|
s.vga_mem_updated = 0;
|
||||||
s.x_tilesize = X_TILESIZE;
|
s.vga_tile_updated = NULL;
|
||||||
s.y_tilesize = Y_TILESIZE;
|
|
||||||
timer_id = BX_NULL_TIMER_HANDLE;
|
timer_id = BX_NULL_TIMER_HANDLE;
|
||||||
s.memory = NULL;
|
s.memory = NULL;
|
||||||
}
|
}
|
||||||
@ -117,18 +116,33 @@ bx_vga_c::~bx_vga_c()
|
|||||||
delete [] s.memory;
|
delete [] s.memory;
|
||||||
s.memory = NULL;
|
s.memory = NULL;
|
||||||
}
|
}
|
||||||
|
if (s.vga_tile_updated != NULL) {
|
||||||
|
delete [] s.vga_tile_updated;
|
||||||
|
s.vga_tile_updated = NULL;
|
||||||
|
}
|
||||||
SIM->get_param_num(BXPN_VGA_UPDATE_FREQUENCY)->set_handler(NULL);
|
SIM->get_param_num(BXPN_VGA_UPDATE_FREQUENCY)->set_handler(NULL);
|
||||||
BX_DEBUG(("Exit"));
|
BX_DEBUG(("Exit"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void bx_vga_c::init(void)
|
void bx_vga_c::init(void)
|
||||||
{
|
{
|
||||||
|
unsigned x,y;
|
||||||
|
|
||||||
BX_VGA_THIS extension_init = 0;
|
BX_VGA_THIS extension_init = 0;
|
||||||
BX_VGA_THIS pci_enabled = 0;
|
BX_VGA_THIS pci_enabled = 0;
|
||||||
|
|
||||||
BX_VGA_THIS init_standard_vga();
|
BX_VGA_THIS init_standard_vga();
|
||||||
BX_VGA_THIS init_vga_extension();
|
BX_VGA_THIS init_vga_extension();
|
||||||
|
|
||||||
|
BX_VGA_THIS s.num_x_tiles = BX_VGA_THIS s.max_xres / X_TILESIZE +
|
||||||
|
((BX_VGA_THIS s.max_xres % X_TILESIZE) > 0);
|
||||||
|
BX_VGA_THIS s.num_y_tiles = BX_VGA_THIS s.max_yres / Y_TILESIZE +
|
||||||
|
((BX_VGA_THIS s.max_yres % Y_TILESIZE) > 0);
|
||||||
|
BX_VGA_THIS s.vga_tile_updated = new bx_bool[BX_VGA_THIS s.num_x_tiles * BX_VGA_THIS s.num_y_tiles];
|
||||||
|
for (y = 0; y < BX_VGA_THIS s.num_y_tiles; y++)
|
||||||
|
for (x = 0; x < BX_VGA_THIS s.num_x_tiles; x++)
|
||||||
|
SET_TILE_UPDATED(x, y, 0);
|
||||||
|
|
||||||
char *strptr = SIM->get_param_string(BXPN_VGA_EXTENSION)->getptr();
|
char *strptr = SIM->get_param_string(BXPN_VGA_EXTENSION)->getptr();
|
||||||
if (!BX_VGA_THIS extension_init &&
|
if (!BX_VGA_THIS extension_init &&
|
||||||
(strlen(strptr) > 0) && strcmp(strptr, "none")) {
|
(strlen(strptr) > 0) && strcmp(strptr, "none")) {
|
||||||
@ -142,7 +156,6 @@ void bx_vga_c::init(void)
|
|||||||
void bx_vga_c::init_standard_vga(void)
|
void bx_vga_c::init_standard_vga(void)
|
||||||
{
|
{
|
||||||
unsigned i,string_i;
|
unsigned i,string_i;
|
||||||
unsigned x,y;
|
|
||||||
int argc;
|
int argc;
|
||||||
char *argv[16];
|
char *argv[16];
|
||||||
char *ptr;
|
char *ptr;
|
||||||
@ -235,10 +248,10 @@ void bx_vga_c::init_standard_vga(void)
|
|||||||
BX_VGA_THIS s.last_yres = 0;
|
BX_VGA_THIS s.last_yres = 0;
|
||||||
BX_VGA_THIS s.last_bpp = 8;
|
BX_VGA_THIS s.last_bpp = 8;
|
||||||
|
|
||||||
|
BX_VGA_THIS s.max_xres = 800;
|
||||||
|
BX_VGA_THIS s.max_yres = 600;
|
||||||
|
|
||||||
BX_VGA_THIS s.vga_mem_updated = 0;
|
BX_VGA_THIS s.vga_mem_updated = 0;
|
||||||
for (y=0; y<480/Y_TILESIZE; y++)
|
|
||||||
for (x=0; x<640/X_TILESIZE; x++)
|
|
||||||
SET_TILE_UPDATED (x, y, 0);
|
|
||||||
|
|
||||||
// initialize memory, handlers and timer (depending on extension)
|
// initialize memory, handlers and timer (depending on extension)
|
||||||
extname = SIM->get_param_string(BXPN_VGA_EXTENSION)->getptr();
|
extname = SIM->get_param_string(BXPN_VGA_EXTENSION)->getptr();
|
||||||
@ -282,8 +295,8 @@ void bx_vga_c::init_standard_vga(void)
|
|||||||
}
|
}
|
||||||
delete [] options;
|
delete [] options;
|
||||||
}
|
}
|
||||||
bx_gui->init(argc, argv, BX_MAX_XRES, BX_MAX_YRES, BX_VGA_THIS s.x_tilesize,
|
bx_gui->init(argc, argv, BX_VGA_THIS s.max_xres, BX_VGA_THIS s.max_yres,
|
||||||
BX_VGA_THIS s.y_tilesize);
|
X_TILESIZE, Y_TILESIZE);
|
||||||
for (i = 1; i < (unsigned)argc; i++) {
|
for (i = 1; i < (unsigned)argc; i++) {
|
||||||
if (argv[i] != NULL) {
|
if (argv[i] != NULL) {
|
||||||
free(argv[i]);
|
free(argv[i]);
|
||||||
@ -351,6 +364,8 @@ void bx_vga_c::init_vga_extension(void)
|
|||||||
} else {
|
} else {
|
||||||
BX_VGA_THIS vbe.max_bpp=max_bpp;
|
BX_VGA_THIS vbe.max_bpp=max_bpp;
|
||||||
}
|
}
|
||||||
|
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 extension_init = 1;
|
BX_VGA_THIS extension_init = 1;
|
||||||
|
|
||||||
BX_INFO(("VBE Bochs Display Extension Enabled"));
|
BX_INFO(("VBE Bochs Display Extension Enabled"));
|
||||||
@ -540,9 +555,9 @@ void bx_vga_c::after_restore_state(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
bx_gui->set_text_charmap(&BX_VGA_THIS s.memory[0x20000 + BX_VGA_THIS s.charmap_address]);
|
bx_gui->set_text_charmap(&BX_VGA_THIS s.memory[0x20000 + BX_VGA_THIS s.charmap_address]);
|
||||||
BX_VGA_THIS s.last_xres = BX_MAX_XRES;
|
BX_VGA_THIS s.last_xres = BX_VGA_THIS s.max_xres;
|
||||||
BX_VGA_THIS s.last_yres = BX_MAX_YRES;
|
BX_VGA_THIS s.last_yres = BX_VGA_THIS s.max_yres;
|
||||||
BX_VGA_THIS redraw_area(0, 0, BX_MAX_XRES, BX_MAX_YRES);
|
BX_VGA_THIS redraw_area(0, 0, BX_VGA_THIS s.max_xres, BX_VGA_THIS s.max_yres);
|
||||||
if (BX_VGA_THIS vbe.enabled) {
|
if (BX_VGA_THIS vbe.enabled) {
|
||||||
bx_gui->dimension_update(BX_VGA_THIS vbe.xres, BX_VGA_THIS vbe.yres, 0, 0,
|
bx_gui->dimension_update(BX_VGA_THIS vbe.xres, BX_VGA_THIS vbe.yres, 0, 0,
|
||||||
BX_VGA_THIS vbe.bpp);
|
BX_VGA_THIS vbe.bpp);
|
||||||
@ -3073,7 +3088,7 @@ bx_vga_c::vbe_mem_write(bx_phy_address addr, Bit8u value)
|
|||||||
y_tileno = ((offset / BX_VGA_THIS vbe.bpp_multiplier) / BX_VGA_THIS vbe.virtual_xres) / Y_TILESIZE;
|
y_tileno = ((offset / BX_VGA_THIS vbe.bpp_multiplier) / BX_VGA_THIS vbe.virtual_xres) / Y_TILESIZE;
|
||||||
x_tileno = ((offset / BX_VGA_THIS vbe.bpp_multiplier) % BX_VGA_THIS vbe.virtual_xres) / X_TILESIZE;
|
x_tileno = ((offset / BX_VGA_THIS vbe.bpp_multiplier) % BX_VGA_THIS vbe.virtual_xres) / X_TILESIZE;
|
||||||
|
|
||||||
if ((y_tileno < BX_NUM_Y_TILES) && (x_tileno < BX_NUM_X_TILES))
|
if ((y_tileno < BX_VGA_THIS s.num_y_tiles) && (x_tileno < BX_VGA_THIS s.num_x_tiles))
|
||||||
{
|
{
|
||||||
BX_VGA_THIS s.vga_mem_updated = 1;
|
BX_VGA_THIS s.vga_mem_updated = 1;
|
||||||
SET_TILE_UPDATED (x_tileno, y_tileno, 1);
|
SET_TILE_UPDATED (x_tileno, y_tileno, 1);
|
||||||
@ -3520,8 +3535,8 @@ Bit32u bx_vga_c::vbe_write(Bit32u address, Bit32u value, unsigned io_len)
|
|||||||
}
|
}
|
||||||
if (needs_update) {
|
if (needs_update) {
|
||||||
BX_VGA_THIS s.vga_mem_updated = 1;
|
BX_VGA_THIS s.vga_mem_updated = 1;
|
||||||
for (unsigned xti = 0; xti < BX_NUM_X_TILES; xti++) {
|
for (unsigned xti = 0; xti < BX_VGA_THIS s.num_x_tiles; xti++) {
|
||||||
for (unsigned yti = 0; yti < BX_NUM_Y_TILES; yti++) {
|
for (unsigned yti = 0; yti < BX_VGA_THIS s.num_y_tiles; yti++) {
|
||||||
SET_TILE_UPDATED (xti, yti, 1);
|
SET_TILE_UPDATED (xti, yti, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,15 +95,10 @@
|
|||||||
#define VBE_DISPI_TOTAL_VIDEO_MEMORY_KB (VBE_DISPI_TOTAL_VIDEO_MEMORY_MB * 1024)
|
#define VBE_DISPI_TOTAL_VIDEO_MEMORY_KB (VBE_DISPI_TOTAL_VIDEO_MEMORY_MB * 1024)
|
||||||
#define VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES (VBE_DISPI_TOTAL_VIDEO_MEMORY_KB * 1024)
|
#define VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES (VBE_DISPI_TOTAL_VIDEO_MEMORY_KB * 1024)
|
||||||
|
|
||||||
#define BX_MAX_XRES VBE_DISPI_MAX_XRES
|
|
||||||
#define BX_MAX_YRES VBE_DISPI_MAX_YRES
|
|
||||||
|
|
||||||
// End Bochs VBE definitions
|
// End Bochs VBE definitions
|
||||||
|
|
||||||
#define X_TILESIZE 16
|
#define X_TILESIZE 16
|
||||||
#define Y_TILESIZE 24
|
#define Y_TILESIZE 24
|
||||||
#define BX_NUM_X_TILES (BX_MAX_XRES /X_TILESIZE)
|
|
||||||
#define BX_NUM_Y_TILES (BX_MAX_YRES /Y_TILESIZE)
|
|
||||||
|
|
||||||
#if BX_USE_VGA_SMF
|
#if BX_USE_VGA_SMF
|
||||||
# define BX_VGA_SMF static
|
# define BX_VGA_SMF static
|
||||||
@ -264,13 +259,11 @@ protected:
|
|||||||
|
|
||||||
bx_bool vga_enabled;
|
bx_bool vga_enabled;
|
||||||
bx_bool vga_mem_updated;
|
bx_bool vga_mem_updated;
|
||||||
unsigned x_tilesize;
|
|
||||||
unsigned y_tilesize;
|
|
||||||
unsigned line_offset;
|
unsigned line_offset;
|
||||||
unsigned line_compare;
|
unsigned line_compare;
|
||||||
unsigned vertical_display_end;
|
unsigned vertical_display_end;
|
||||||
unsigned blink_counter;
|
unsigned blink_counter;
|
||||||
bx_bool vga_tile_updated[BX_NUM_X_TILES][BX_NUM_Y_TILES];
|
bx_bool *vga_tile_updated;
|
||||||
Bit8u *memory;
|
Bit8u *memory;
|
||||||
Bit32u memsize;
|
Bit32u memsize;
|
||||||
Bit8u text_snapshot[128 * 1024]; // current text snapshot
|
Bit8u text_snapshot[128 * 1024]; // current text snapshot
|
||||||
@ -281,6 +274,10 @@ protected:
|
|||||||
Bit16u last_xres;
|
Bit16u last_xres;
|
||||||
Bit16u last_yres;
|
Bit16u last_yres;
|
||||||
Bit8u last_bpp;
|
Bit8u last_bpp;
|
||||||
|
Bit16u max_xres;
|
||||||
|
Bit16u max_yres;
|
||||||
|
Bit16u num_x_tiles;
|
||||||
|
Bit16u num_y_tiles;
|
||||||
} s; // state information
|
} s; // state information
|
||||||
|
|
||||||
int timer_id;
|
int timer_id;
|
||||||
|
Loading…
Reference in New Issue
Block a user