From bee3e0a20b4360f7e2a5de0684b15936212b62d1 Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Fri, 17 Dec 2010 18:09:30 +0200 Subject: [PATCH] Add feature to make debug dump of VGA I/O and memory writes These kinds of debug dumps are useful for encoding text mode output too fast to capture using usual means. --- Changelog.utf8 | 1 + org/jpc/emulator/pci/peripheral/VGACard.java | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/Changelog.utf8 b/Changelog.utf8 index 5d31ea3..fa91bcd 100644 --- a/Changelog.utf8 +++ b/Changelog.utf8 @@ -1,6 +1,7 @@ Changes since JPC-RR Release 11.2: ================================== - Add feature to show framerate. +- Add feature to make debug dump of VGA I/O and memory writes. Changes from JPC-RR Release 11.1 to JPC-RR Release 11.2: ======================================================== diff --git a/org/jpc/emulator/pci/peripheral/VGACard.java b/org/jpc/emulator/pci/peripheral/VGACard.java index 3900c5e..7a14d26 100644 --- a/org/jpc/emulator/pci/peripheral/VGACard.java +++ b/org/jpc/emulator/pci/peripheral/VGACard.java @@ -331,6 +331,7 @@ public class VGACard extends AbstractPCIDevice implements IOPortCapable, TimerRe private boolean returningFromVretrace; private boolean paletteDebuggingEnabled; //Not saved. + private PrintStream vgaDebugSaveIO; //Not saved. private static long vgaClockToSystemClock(long vgaTicks) { @@ -635,6 +636,20 @@ public class VGACard extends AbstractPCIDevice implements IOPortCapable, TimerRe paletteDebuggingEnabled = _state; } + public void DEBUGOPTION_VGA_io_debugging(boolean _state) + { + if(_state) + try { + vgaDebugSaveIO = new PrintStream("VGA-io-debug.text"); + } catch(IOException e) { + e.printStackTrace(); + } + else if(vgaDebugSaveIO != null) { + vgaDebugSaveIO.close(); + vgaDebugSaveIO = null; + } + } + public String getFramerate() { long numerator = VGA_MASTER_CLOCK_FREQ; @@ -760,15 +775,24 @@ public class VGACard extends AbstractPCIDevice implements IOPortCapable, TimerRe vgaIOPortWriteByte(address, data); } + private void ioDebug(String msg) + { + if(vgaDebugSaveIO == null) + return; + vgaDebugSaveIO.println(timeSource.getTime() + " " + msg); + } + public void ioPortWriteWord(int address, int data) { switch(address) { case 0x1ce: case 0xff80: + ioDebug("IOWRITE_VESA " + Integer.toHexString(address) + " " + Integer.toHexString(data)); vbeIOPortWriteIndex(data); break; case 0x1cf: case 0xff81: + ioDebug("IOWRITE_VESA " + Integer.toHexString(address) + " " + Integer.toHexString(data)); vbeIOPortWriteData(data); break; default: @@ -834,6 +858,8 @@ public class VGACard extends AbstractPCIDevice implements IOPortCapable, TimerRe if((data & ~0xff) != 0) System.err.println("Error: VGA byte sized write data out of range???"); + ioDebug("IOWRITE_VGA " + Integer.toHexString(address) + " " + Integer.toHexString(data)); + switch(address) { case 0x3b4: case 0x3d4: @@ -1423,6 +1449,7 @@ public class VGACard extends AbstractPCIDevice implements IOPortCapable, TimerRe public void setByte(int offset, byte data) { /* convert to VGA memory offset */ + upperBackref.ioDebug("LOWWRITE " + Integer.toHexString(offset) + " " + Integer.toHexString(data)); int memoryMapMode = (upperBackref.graphicsRegister[GR_INDEX_MISC] >>> 2) & 3; offset &= 0x1ffff; boolean fromGraphicsMemory = (offset < 65536); -- 2.11.4.GIT