vga: correctly advertise the latest bochs version, and make it r/w (fix #768)

This commit is contained in:
Fabian 2022-11-21 11:23:00 -06:00
parent baffa6c0d6
commit cf61ac635a

View file

@ -191,6 +191,9 @@ function VGAScreen(cpu, bus, vga_memory_size)
*/
this.latch_dword = 0;
/** @type {number} */
this.svga_version = 0xB0C5;
/** @type {number} */
this.svga_width = 0;
@ -1998,6 +2001,16 @@ VGAScreen.prototype.port1CF_write = function(value)
switch(this.dispi_index)
{
case 0:
if(value >= 0xB0C0 && value <= 0xB0C5)
{
this.svga_version = value;
}
else
{
dbg_log("Invalid version value: " + h(value), LOG_VGA);
}
break;
case 1:
this.svga_width = value;
if(this.svga_width > MAX_XRES)
@ -2080,8 +2093,7 @@ VGAScreen.prototype.svga_register_read = function(n)
switch(n)
{
case 0:
// id
return 0xB0C0;
return this.svga_version;
case 1:
return this.dispi_enable_value & 2 ? MAX_XRES : this.svga_width;
case 2: