Browse Source

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

Fabian 1 year ago
parent
commit
cf61ac635a
1 changed files with 14 additions and 2 deletions
  1. 14 2
      src/vga.js

+ 14 - 2
src/vga.js

@@ -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: