Skip to content

Commit

Permalink
Add support for VBE_DISPI_INDEX_X_OFFSET
Browse files Browse the repository at this point in the history
Adds support for horizontal offset in Bochs VESA BIOS Extension.

Should fix issue #1088.
  • Loading branch information
chschnell authored and copy committed Sep 8, 2024
1 parent 3c77b98 commit e3b43c1
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/vga.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ function VGAScreen(cpu, bus, vga_memory_size)
* @type {number}
*/
this.svga_offset = 0;

this.svga_offset_x = 0;
this.svga_offset_y = 0;

const pci_revision = 0; // set to 2 for qemu extended registers
Expand Down Expand Up @@ -2123,14 +2123,23 @@ VGAScreen.prototype.port1CF_write = function(value)
dbg_log("SVGA bank offset: " + h(value << 16), LOG_VGA);
this.svga_bank_offset = value << 16;
break;
case 8:
// x offset
dbg_log("SVGA X offset: " + h(value), LOG_VGA);
if(this.svga_offset_x !== value)
{
this.svga_offset_x = value;
this.svga_offset = this.svga_offset_y * this.svga_width + this.svga_offset_x;
this.complete_redraw();
}
break;
case 9:
// y offset
const offset = value * this.svga_width;
dbg_log("SVGA offset: " + h(offset) + " y=" + h(value), LOG_VGA);
dbg_log("SVGA Y offset: " + h(value * this.svga_width) + " y=" + h(value), LOG_VGA);
if(this.svga_offset_y !== value)
{
this.svga_offset_y = value;
this.svga_offset = offset;
this.svga_offset = this.svga_offset_y * this.svga_width + this.svga_offset_x;
this.complete_redraw();
}
break;
Expand Down Expand Up @@ -2204,7 +2213,7 @@ VGAScreen.prototype.svga_register_read = function(n)

case 8:
// x offset
return 0;
return this.svga_offset_x;
case 9:
return this.svga_offset_y;
case 0x0A:
Expand Down

0 comments on commit e3b43c1

Please sign in to comment.