Skip to content

Commit

Permalink
Merge pull request #250 from AppleWin/master
Browse files Browse the repository at this point in the history
Debugger view output QoL (AppleWin#1384, PR AppleWin#1387)
  • Loading branch information
audetto authored Mar 2, 2025
2 parents 9d59fcc + 9d31223 commit 987357a
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 30 deletions.
36 changes: 30 additions & 6 deletions help/dbg-view-output.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,30 +86,42 @@ <h3><a name="View_Video_Modes">Video Modes</a></h3>
<td width="75%"><p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">View pseudo Hi-res Page 5 ($A000).</span></i></p></td>
</tr>
<tr bgcolor="#999999">
<td width="25%"><p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">HGR6</span></b></font></font></p></td>
<td width="75%"><p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">View pseudo Hi-res Page 6 LC Banks 1/2 ($C000-$DFFF).</span></i></p></td>
</tr>
<tr bgcolor="#cccccc">
<td width="25%"><p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">HGR7</span></b></font></font></p></td>
<td width="75%"><p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">View pseudo Hi-res Page 7 LC Banks 2/RAM ($D000-$EFFF).</span></i></p></td>
</tr>
<tr bgcolor="#999999">
<td width="25%"><p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">HGR8</span></b></font></font></p></td>
<td width="75%"><p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">View pseudo Hi-res Page 8 LC Banks RAM ($D000-$EFFF).</span></i></p></td>
</tr>
<tr bgcolor="#cccccc">
<td width="25%"><p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">SHR</span></b></font></font></p></td>
<td width="75%"><p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">View Super Hi-res.<br></span></i></p></td>
</tr>
<tr bgcolor="#cccccc">
<tr bgcolor="#999999">
<td width="25%"><p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">TEXT</span></b></font></font></p></td>
<td width="75%"><p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">View Text screen (current page).</span></i></p></td>
</tr>
<tr bgcolor="#999999">
<tr bgcolor="#cccccc">
<td width="25%"><p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">TEXT1</span></b></font></font></p></td>
<td width="75%"><p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">View Text screen Page 1 ($0400).<br></span></i></p></td>
</tr>
<tr bgcolor="#cccccc">
<tr bgcolor="#999999">
<td width="25%"><p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">TEXT2</span></b></font></font></p></td>
<td width="75%"><p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">View Text screen Page 2 ($0800).</span></i></p></td>
</tr>
<tr bgcolor="#999999">
<tr bgcolor="#cccccc">
<td width="25%"><p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">TEXT80</span></b></font></font></p></td>
<td width="75%"><p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">View 80-column Text screen (current page).<br></span></i></p></td>
</tr>
<tr bgcolor="#cccccc">
<tr bgcolor="#999999">
<td width="25%"><p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">TEXT81</span></b></font></font></p></td>
<td width="75%"><p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">View 80-column Text screen Page 1.</span></i></p></td>
</tr>
<tr bgcolor="#999999">
<tr bgcolor="#cccccc">
<td width="25%"><p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">TEXT82</span></b></font></font></p></td>
<td width="75%"><p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">View 80-column Text screen Page 2.<br></span></i></p></td>
</tr>
Expand Down Expand Up @@ -165,6 +177,18 @@ <h3><a name="View_Output_Keys">Output Keys</a></h3>
<td width="10%"><p><b><font face="Courier">5</font></b></p></td>
<td width="25%"><p>Five</p></td><td width="65%"><p><i>View pseudo page 5<br> ($A000-$BFFF) if graphics,<br>page 1 if text.</i></p></td>
</tr>
<tr>
<td width="10%"><p><b><font face="Courier">6</font></b></p></td>
<td width="25%"><p>Six</p></td><td width="65%"><p><i>View pseudo page 6<br> LC Banks 1/2 ($C000-$DFFF) if graphics,<br>page 1 if text.</i></p></td>
</tr>
<tr>
<td width="10%"><p><b><font face="Courier">7</font></b></p></td>
<td width="25%"><p>Seven</p></td><td width="65%"><p><i>View pseudo page 7<br> LC Banks 2/RAM ($D000-$EFFF) if graphics,<br>page 1 if text.</i></p></td>
</tr>
<tr>
<td width="10%"><p><b><font face="Courier">8</font></b></p></td>
<td width="25%"><p>Eight</p></td><td width="65%"><p><i>View pseudo page 8<br> LC Bank RAM ($E000-$FFFF) if graphics,<br>page 1 if text.</i></p></td>
</tr>
<tr>
<td width="10%"><p><b><font face="Courier">9</font></b></p></td>
<td width="25%"><p>Nine</p></td><td width="65%"><p><i>View current video mode and page.</i></p></td>
Expand Down
30 changes: 26 additions & 4 deletions source/Debugger/Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6800,6 +6800,7 @@ Update_t CmdCyclesReset (int /*nArgs*/)
// View ___________________________________________________________________________________________

// See: CmdWindowViewOutput (int nArgs)
// NOTE: Keep in sync: ViewVideoPage_t, , and getVideoScannerAddressTXT
enum ViewVideoPage_t
{
VIEW_PAGE_X, // current page
Expand All @@ -6808,13 +6809,17 @@ enum ViewVideoPage_t
VIEW_PAGE_2,
VIEW_PAGE_3, // Pseudo
VIEW_PAGE_4, // Pseudo
VIEW_PAGE_5 // Pseudo
VIEW_PAGE_5, // Pseudo
VIEW_PAGE_6, // Pseudo
VIEW_PAGE_7, // Pseudo
VIEW_PAGE_8 // Pseudo
};

static Update_t _ViewOutput ( ViewVideoPage_t iPage, UINT bVideoModeFlags )
{
switch ( iPage )
{
// NOTE: Keep in sync: _ViewOutput() getVideoScannerAddressHGR()
case VIEW_PAGE_X:
bVideoModeFlags |= (!GetVideo().VideoGetSW80STORE() && GetVideo().VideoGetSWPAGE2()) ? VF_PAGE2 : 0;
bVideoModeFlags |= GetVideo().VideoGetSWMIXED() ? VF_MIXED : 0;
Expand All @@ -6825,6 +6830,9 @@ static Update_t _ViewOutput ( ViewVideoPage_t iPage, UINT bVideoModeFlags )
case VIEW_PAGE_3: bVideoModeFlags |= VF_PAGE3; break; // Pseudo Page 3 ($6000)
case VIEW_PAGE_4: bVideoModeFlags |= VF_PAGE4; break; // Pseudo Page 4 ($8000)
case VIEW_PAGE_5: bVideoModeFlags |= VF_PAGE5; break; // Pseudo Page 5 ($A000)
case VIEW_PAGE_6: bVideoModeFlags |= VF_PAGE6; break; // Pseudo Page 6 (LC 1/2 $C000,$D000)
case VIEW_PAGE_7: bVideoModeFlags |= VF_PAGE7; break; // Pseudo Page 7 (LC 2/- $D000,$E000)
case VIEW_PAGE_8: bVideoModeFlags |= VF_PAGE8; break; // Pseudo Page 8 (LC RAM $E000,$F000)
default:
_ASSERT(0);
break;
Expand Down Expand Up @@ -6918,6 +6926,18 @@ static Update_t _ViewOutput ( ViewVideoPage_t iPage, UINT bVideoModeFlags )
{
return _ViewOutput( VIEW_PAGE_5, VF_HIRES ); // Pseudo page ($A000)
}
Update_t CmdViewOutput_HGR6 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_6, VF_HIRES ); // Pseudo page (LC Bank 1/2 $C000,$D000)
}
Update_t CmdViewOutput_HGR7 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_7, VF_HIRES ); // Pseudo page (LC Bank 2/RAM $D000,$E000)
}
Update_t CmdViewOutput_HGR8 (int nArgs)
{
return _ViewOutput( VIEW_PAGE_8, VF_HIRES ); // Pseudo page (LC RAM $E000,$F000)
}
// Double Hi-Res
Update_t CmdViewOutput_DHGRX (int nArgs)
{
Expand Down Expand Up @@ -9221,16 +9241,15 @@ void DebuggerProcessKey ( int keycode )
// 8 Full-screen mode
//
// NOTE: Keep in sync: ViewVideoPage_t, DebuggerProcessKey(), _ViewOutput()
if (((keycode >= '0') && (keycode <= '5'))
|| (keycode == '9'))
if ((keycode >= '0') && (keycode <= '9'))
{
ViewVideoPage_t eVideoPage = VIEW_PAGE_X;
UINT bVideoFlags = 0;

DebugVideoMode::Instance().Get( &bVideoFlags );
uint32_t bSavedVideoModeFlags = bVideoFlags;

bVideoFlags &= ~(VF_MIXED | VF_PAGE0 | VF_PAGE2 | VF_PAGE3 | VF_PAGE4 | VF_PAGE5);
bVideoFlags &= ~(VF_MIXED | VF_PAGE0 | VF_PAGE2 | VF_PAGE3 | VF_PAGE4 | VF_PAGE5 | VF_PAGE6 | VF_PAGE7 | VF_PAGE8);
switch (keycode)
{
case '0': eVideoPage = VIEW_PAGE_0; bVideoFlags |= VF_PAGE0; break;
Expand All @@ -9239,6 +9258,9 @@ void DebuggerProcessKey ( int keycode )
case '3': eVideoPage = VIEW_PAGE_3; bVideoFlags |= VF_PAGE3; break;
case '4': eVideoPage = VIEW_PAGE_4; bVideoFlags |= VF_PAGE4; break;
case '5': eVideoPage = VIEW_PAGE_5; bVideoFlags |= VF_PAGE5; break;
case '6': eVideoPage = VIEW_PAGE_6; bVideoFlags |= VF_PAGE6; break;
case '7': eVideoPage = VIEW_PAGE_7; bVideoFlags |= VF_PAGE7; break;
case '8': eVideoPage = VIEW_PAGE_8; bVideoFlags |= VF_PAGE8; break;
case '9': /* Don't use VIEW_PAGE_X as it is handled below*/; break;
default:
bool bUnknownViewVideoPage = false;
Expand Down
3 changes: 3 additions & 0 deletions source/Debugger/Debugger_Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
{"HGR3" , CmdViewOutput_HGR3 , CMD_VIEW_HGR3 , "View pseudo Hi-res Page 3 ($6000)" },
{"HGR4" , CmdViewOutput_HGR4 , CMD_VIEW_HGR4 , "View pseudo Hi-res Page 4 ($8000)" },
{"HGR5" , CmdViewOutput_HGR5 , CMD_VIEW_HGR5 , "View pseudo Hi-res Page 5 ($A000)" },
{"HGR6" , CmdViewOutput_HGR6 , CMD_VIEW_HGR6 , "View pseudo Hi-res Page 6 (LC 1/2 $C000,$D000)" },
{"HGR7" , CmdViewOutput_HGR7 , CMD_VIEW_HGR7 , "View pseudo Hi-res Page 7 (LC 2/- $D000,$E000)" },
{"HGR8" , CmdViewOutput_HGR8 , CMD_VIEW_HGR8 , "View pseudo Hi-res Page 8 (LC RAM $E000,$F000)" },
{"DHGR" , CmdViewOutput_DHGRX , CMD_VIEW_DHGRX , "View Double Hi-res (current page)" },
{"DHGR1" , CmdViewOutput_DHGR1 , CMD_VIEW_DHGR1 , "View Double Hi-res Page 1" },
{"DHGR2" , CmdViewOutput_DHGR2 , CMD_VIEW_DHGR2 , "View Double Hi-res Page 2" },
Expand Down
6 changes: 6 additions & 0 deletions source/Debugger/Debugger_Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,9 @@
, CMD_VIEW_HGR3
, CMD_VIEW_HGR4
, CMD_VIEW_HGR5
, CMD_VIEW_HGR6
, CMD_VIEW_HGR7
, CMD_VIEW_HGR8
, CMD_VIEW_DHGRX
, CMD_VIEW_DHGR1
, CMD_VIEW_DHGR2
Expand Down Expand Up @@ -788,6 +791,9 @@
Update_t CmdViewOutput_HGR3 (int nArgs);
Update_t CmdViewOutput_HGR4 (int nArgs);
Update_t CmdViewOutput_HGR5 (int nArgs);
Update_t CmdViewOutput_HGR6 (int nArgs);
Update_t CmdViewOutput_HGR7 (int nArgs);
Update_t CmdViewOutput_HGR8 (int nArgs);
Update_t CmdViewOutput_DHGRX (int nArgs);
Update_t CmdViewOutput_DHGR1 (int nArgs);
Update_t CmdViewOutput_DHGR2 (int nArgs);
Expand Down
33 changes: 30 additions & 3 deletions source/NTSC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// Globals (Private) __________________________________________________
static int g_nVideoCharSet = 0;
static int g_nVideoMixed = 0;
static int g_nHiresPage = 1;
static int g_nHiresPage = 1; // See: getVideoScannerAddressHGR()
static int g_nTextPage = 1;

static bool g_bDelayVideoMode = false; // NB. No need to save to save-state, as it will be done immediately after opcode completes in NTSC_VideoUpdateCycles()
Expand Down Expand Up @@ -866,10 +866,25 @@ INLINE uint16_t getVideoScannerAddressTXT()
//===========================================================================
INLINE uint16_t getVideoScannerAddressHGR()
{
// NOTE: Keep in sync: _ViewOutput() getVideoScannerAddressHGR()
const uint16_t aPageAddr[9] =
{
0x0000 // [0]
, 0x2000 // [1]
, 0x4000 // [2]
, 0x6000 // [3]
, 0x8000 // [4]
, 0xA000 // [5]
, 0xC000 // [6] LC Bank 1
, 0xD000 // [7] LC Bank 2
, 0xE000 // [8] LC RAM
};

// NB. For both A2 and //e use APPLE_IIE_HORZ_CLOCK_OFFSET - see VideoGetScannerAddress() where only TEXT mode adds $1000
uint16_t nAddress = (g_aClockVertOffsetsHGR[g_nVideoClockVert ]
+ APPLE_IIE_HORZ_CLOCK_OFFSET[g_nVideoClockVert/64][g_nVideoClockHorz]
+ (g_nHiresPage * 0x2000));
+ aPageAddr[g_nHiresPage]); // We can view oddball addresses like LC Bank 1/2/$E000 for VF_PAGE_6, VF_PAGE_7, VF_PAGE_8

return nAddress;
}

Expand Down Expand Up @@ -1609,7 +1624,7 @@ void updateScreenSingleHires40 (long cycles6502)
}
else if (g_nVideoClockHorz >= VIDEO_SCANNER_HORZ_START)
{
uint8_t *pMain = MemGetMainPtr(addr);
uint8_t *pMain = MemGetMainPtrWithLC(addr);
uint8_t m = pMain[0];
uint16_t bits = g_aPixelDoubleMaskHGR[m & 0x7F]; // Optimization: hgrbits second 128 entries are mirror of first 128
if (m & 0x80)
Expand Down Expand Up @@ -2040,6 +2055,18 @@ void NTSC_SetVideoMode( uint32_t uVideoModeFlags, bool bDelay/*=false*/ )
{
g_nHiresPage = 5;
}
if( uVideoModeFlags & VF_PAGE6) // Pseudo page LC 1/2 ($C000,$D000)
{
g_nHiresPage = 6; // Keep in sync: getVideoScannerAddressHGR()
}
if( uVideoModeFlags & VF_PAGE7) // Pseudo page LC 2/- ($D000,$E000)
{
g_nHiresPage = 7; // Keep in sync: getVideoScannerAddressHGR()
}
if( uVideoModeFlags & VF_PAGE8) // Pseudo page LC RAM ($E000,$FFF)
{
g_nHiresPage = 8; // Keep in sync: getVideoScannerAddressHGR()
}

if (GetVideo().GetVideoRefreshRate() == VR_50HZ && g_pVideoAddress) // GH#763 / NB. g_pVideoAddress==NULL when called via VideoResetState()
{
Expand Down
6 changes: 3 additions & 3 deletions source/RGBMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ static void CopySource(int w, int h, int sx, int sy, bgra_t *pVideoAddress, cons

void UpdateHiResCell (int x, int y, uint16_t addr, bgra_t *pVideoAddress)
{
uint8_t *pMain = MemGetMainPtr(addr);
uint8_t *pMain = MemGetMainPtrWithLC(addr);
BYTE byteval1 = (x > 0) ? *(pMain-1) : 0;
BYTE byteval2 = *(pMain);
BYTE byteval3 = (x < 39) ? *(pMain+1) : 0;
Expand Down Expand Up @@ -655,7 +655,7 @@ void UpdateHiResRGBCell(int x, int y, uint16_t addr, bgra_t* pVideoAddress)
int xoffset = x & 1; // offset to start of the 2 bytes
addr -= xoffset;

uint8_t* pMain = MemGetMainPtr(addr);
uint8_t* pMain = MemGetMainPtrWithLC(addr);

// We need all 28 bits because each pixel needs a three bit evaluation
uint8_t byteval1 = (x < 2 ? 0 : *(pMain - 1));
Expand Down Expand Up @@ -1104,7 +1104,7 @@ void UpdateText80ColorCell(int x, int y, uint16_t addr, bgra_t* pVideoAddress, u
// Duochrome HGR (some RGB cards only)
void UpdateHiResDuochromeCell(int x, int y, uint16_t addr, bgra_t* pVideoAddress)
{
BYTE bits = *MemGetMainPtr(addr);
BYTE bits = *MemGetMainPtrWithLC(addr);
BYTE val = *MemGetAuxPtr(addr);
const uint8_t foreground = val >> 4;
const uint8_t background = val & 0x0F;
Expand Down
32 changes: 18 additions & 14 deletions source/Video.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,24 @@ enum VideoRefreshRate_e
};

enum VideoFlag_e
{
VF_80COL = 0x00000001,
VF_DHIRES = 0x00000002,
VF_HIRES = 0x00000004,
VF_80STORE= 0x00000008,
VF_MIXED = 0x00000010,
VF_PAGE2 = 0x00000020, // Text or Hires
VF_TEXT = 0x00000040,
VF_SHR = 0x00000080, // For VidHD's support for IIgs SHR video modes
VF_80COL_AUX_EMPTY = 0x00000100, // For 80COL when aux slot is empty (returns floating bus)
VF_PAGE0 = 0x10000000, // Debugger: Pseudo Page $00 (Poorman's heatmap)
VF_PAGE3 = 0x20000000, // Debugger: Pseudo Page $60 (Poorman's heatmap)
VF_PAGE4 = 0x40000000, // Debugger: Pseudo Page $80 (Poorman's heatmap)
VF_PAGE5 = 0x80000000, // Debugger: Pseudo Page $A0 (Poorman's heatmap)
{ // 76543210
VF_80COL = 0x00000001,
VF_DHIRES = 0x00000002,
VF_HIRES = 0x00000004,
VF_80STORE = 0x00000008,
VF_MIXED = 0x00000010,
VF_PAGE2 = 0x00000020, // Text or Hires
VF_TEXT = 0x00000040,
VF_SHR = 0x00000080, // For VidHD's support for IIgs SHR video modes
VF_80COL_AUX_EMPTY = 0x00000100, // For 80COL when aux slot is empty (returns floating bus)

VF_PAGE0 = 0x10000000, // Debugger: Pseudo Page $00 (Poorman's heatmap)
VF_PAGE3 = 0x20000000, // Debugger: Pseudo Page $60 (Poorman's heatmap)
VF_PAGE4 = 0x40000000, // Debugger: Pseudo Page $80 (Poorman's heatmap)
VF_PAGE5 = 0x80000000, // Debugger: Pseudo Page $A0 (Poorman's heatmap)
VF_PAGE6 = 0x00000200, // Debugger: Pseudo Page $C0 (Poorman's heatmap) LC Bank 1/2
VF_PAGE7 = 0x00000400, // Debugger: Pseudo Page $D0 (Poorman's heatmap) LC Bank 2/-
VF_PAGE8 = 0x00000800 // Debugger: Psuedo Page $E0 (Poorman's heatmap) LC Bank RAM
};

enum AppleFont_e
Expand Down

0 comments on commit 987357a

Please sign in to comment.