Skip to content

Commit

Permalink
Allow VGA DS to specify a start relative to actual (sum) as well
Browse files Browse the repository at this point in the history
  • Loading branch information
joncampbell123 committed Sep 2, 2023
1 parent 958e445 commit c340222
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions include/vga.h
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ typedef struct VGA_Complexity_t {

typedef struct VGA_Override_t {
bool enable = false;
bool start_sum = false;
uint32_t start = ~uint32_t(0u);
} VGA_Override;

Expand Down
6 changes: 4 additions & 2 deletions src/debug/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ static FPU_rec oldfpu;

void VGA_DebugRedraw(void);

void VGA_DebugOverrideStart(uint32_t ofs);
void VGA_DebugOverrideStart(uint32_t ofs,bool sum);
void VGA_ResetDebugOverrides(void);

bool IsDebuggerActive(void) {
Expand Down Expand Up @@ -2822,7 +2822,9 @@ bool ParseCommand(char* str) {
while (*found == ' ') found++;

if (cmd2 == "START") {
VGA_DebugOverrideStart(strtoul(found,NULL,16/*hexadecimal*/));
bool sum = false;
if (*found == '+') { sum = true; found++; }
VGA_DebugOverrideStart(strtoul(found,NULL,16/*hexadecimal*/),sum);
VGA_DebugRedraw();
}
else if (cmd2 == "X") {
Expand Down
11 changes: 9 additions & 2 deletions src/hardware/vga_draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3692,7 +3692,12 @@ static void VGA_DisplayStartLatch(Bitu /*val*/) {
vga.draw.bytes_skip = vga.config.bytes_skip;

if (vga.overopts.enable) {
if (vga.overopts.start != ~uint32_t(0u)) vga.config.real_start = vga.overopts.start & vga.mem.memmask;
if (vga.overopts.start != ~uint32_t(0u)) {
if (vga.overopts.start_sum)
vga.config.real_start = (vga.config.real_start + vga.overopts.start) & vga.mem.memmask;
else
vga.config.real_start = vga.overopts.start & vga.mem.memmask;
}
}

/* TODO: When does 640x480 2-color mode latch foreground/background colors from the DAC? */
Expand Down Expand Up @@ -6217,13 +6222,15 @@ void VGA_DebugRedraw(void) {
}
}

void VGA_DebugOverrideStart(uint32_t ofs) {
void VGA_DebugOverrideStart(uint32_t ofs,bool sum) {
vga.overopts.start_sum = sum;
vga.overopts.start = ofs;
vga.overopts.enable = true;
}

void VGA_ResetDebugOverrides(void) {
vga.overopts.start = ~uint32_t(0ul);
vga.overopts.start_sum = false;
vga.overopts.enable = false;
}

Expand Down

4 comments on commit c340222

@Torinde
Copy link
Contributor

@Torinde Torinde commented on c340222 Sep 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This broke builds mingw32-lowend (and thus WinXP installer) and HXDOS

@joncampbell123
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This broke builds mingw32-lowend (and thus WinXP installer) and HXDOS

What? How?

I'm using C++11 style features of C++, it should work there too.

@maron2000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlike the regular MinGW builds, MinGW low-end and HX-DOS doesn't support debug functions, so maybe excluding VGA_DebugRedraw(void) and other functions in vga_draw.cpp by #if C_DEBUG will help.

@joncampbell123
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlike the regular MinGW builds, MinGW low-end and HX-DOS doesn't support debug functions, so maybe excluding VGA_DebugRedraw(void) and other functions in vga_draw.cpp by #if C_DEBUG will help.

Ah, got it!

Please sign in to comment.