Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for VBE_DISPI_INDEX_X_OFFSET #1147

Merged
merged 2 commits into from
Sep 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 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 All @@ -2154,6 +2163,9 @@ VGAScreen.prototype.port1CF_write = function(value)

if(this.svga_enabled && this.dispi_index === 4)
{
this.svga_offset = 0;
this.svga_offset_x = 0;
this.svga_offset_y = 0;
this.set_size_graphical(this.svga_width, this.svga_height, this.svga_bpp, this.svga_width, this.svga_height);
this.bus.send("screen-set-mode", true);
this.graphical_mode = true;
Expand Down Expand Up @@ -2204,7 +2216,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
Loading