Skip to content

Commit

Permalink
VGA DS START command to force start address
Browse files Browse the repository at this point in the history
  • Loading branch information
joncampbell123 committed Sep 2, 2023
1 parent 0d032a1 commit 958e445
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Next version:
- Add "VRD" debugger command to force redraw of the VGA screen.
- Add VGA debug set commands to force a video start address and another
to clear all debug settings.

2023.09.01
- Disable by default message confirmation after snapshot and AVI video
Expand Down
6 changes: 6 additions & 0 deletions include/vga.h
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,11 @@ typedef struct VGA_Complexity_t {
}
} VGA_Complexity;

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

typedef struct VGA_Type_t {
VGAModes mode = {}; /* The mode the vga system is in */
VGAModes lastmode = {};
Expand All @@ -672,6 +677,7 @@ typedef struct VGA_Type_t {
VGA_Memory mem;
VGA_LFB lfb = {};
VGA_Complexity complexity = {};
VGA_Override overopts = {};
} VGA_Type;


Expand Down
25 changes: 24 additions & 1 deletion src/debug/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ static FPU_rec oldfpu;

void VGA_DebugRedraw(void);

void VGA_DebugOverrideStart(uint32_t ofs);
void VGA_ResetDebugOverrides(void);

bool IsDebuggerActive(void) {
return debugging;
}
Expand Down Expand Up @@ -2811,7 +2814,27 @@ bool ParseCommand(char* str) {
return false;
}

if (command == "FONTDUMP") { // Dump font RAM to file
if (command == "DS") {
std::string cmd2;
while (*found == ' ') found++;
stream >> cmd2;
while (*found != 0 && *found != ' ') found++;
while (*found == ' ') found++;

if (cmd2 == "START") {
VGA_DebugOverrideStart(strtoul(found,NULL,16/*hexadecimal*/));
VGA_DebugRedraw();
}
else if (cmd2 == "X") {
VGA_ResetDebugOverrides();
VGA_DebugRedraw();
}
else {
DEBUG_ShowMsg("Unknown VGA debug command");
return false;
}
}
else if (command == "FONTDUMP") { // Dump font RAM to file
/* Rule: If the file extension is .BIN, write the entire contents of bitplane 2 where the font resides (64KB).
* If the file extension is .BMP, write only the visible font characters in a neat 8x8 (256) matrix.
* If you run this when EGA/VGA graphics are active, you will get "jibberish" based on the graphics on
Expand Down
15 changes: 15 additions & 0 deletions src/hardware/vga_draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3691,6 +3691,10 @@ static void VGA_DisplayStartLatch(Bitu /*val*/) {
vga.config.real_start=vga.config.display_start & vga.mem.memmask;
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;
}

/* TODO: When does 640x480 2-color mode latch foreground/background colors from the DAC? */
if (machine == MCH_MCGA && (vga.other.mcga_mode_control & 2)) {//640x480 2-color mode MCGA
VGA_DAC_UpdateColorPalette();
Expand Down Expand Up @@ -6202,6 +6206,7 @@ bool IsDebuggerActive(void);
void VGA_DebugRedraw(void) {
if (IsDebuggerActive()) {
RENDER_EndUpdate(true);
vga.draw.lines_done = vga.draw.lines_total;
PIC_RemoveEvents(VGA_Other_VertInterrupt);
PIC_RemoveEvents(VGA_VerticalTimer);
PIC_RemoveEvents(VGA_PanningLatch);
Expand All @@ -6212,6 +6217,16 @@ void VGA_DebugRedraw(void) {
}
}

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

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

void VGA_CheckScanLength(void) {
switch (vga.mode) {
case M_EGA:
Expand Down

0 comments on commit 958e445

Please sign in to comment.