mirror of https://github.com/stella-emu/stella.git
Some cleanups to the RomListWidget. Long '.byte' lines no longer spill
over onto the opposite side of the screen. Breakpoints set by clicking in RomListWidget only apply if they've actually been enabled. This fixes a bug whereby a breakpoint could look like it is enabled when it really isn't. Related to this, breakpoints cannot be set for disassembly lines that don't contain a valid address or an empty bytes area (basically, empty lines and lines containing '.byte' items). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1970 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
1ee61ab568
commit
dc22bc6b04
|
@ -193,8 +193,7 @@ bool CartDebug::disassemble(const string& autocode, bool force)
|
|||
(addressToLine(PC) == -1);
|
||||
if(changed)
|
||||
{
|
||||
// We only use the reset vector when we're actually in the startup bank
|
||||
// Otherwise, we look at previous accesses to this bank to begin
|
||||
// Look at previous accesses to this bank to begin
|
||||
// If no previous address exists, use the current program counter
|
||||
uInt16 start = myStartAddresses[getBank()];
|
||||
if(start == 0)
|
||||
|
|
|
@ -1039,8 +1039,3 @@ const DiStella::Instruction_tag DiStella::ourLookup[256] = {
|
|||
/* fe */ { "INC", ABSOLUTE_X, M_ABSX, WRITE, 7 }, /* Absolute,X */
|
||||
/* ff */ { "isb", ABSOLUTE_X, M_ABSX, WRITE, 7 }
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const int DiStella::ourCLength[14] = {
|
||||
1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 0
|
||||
};
|
||||
|
|
|
@ -145,8 +145,6 @@ class DiStella
|
|||
uInt8 cycles;
|
||||
};
|
||||
static const Instruction_tag ourLookup[256];
|
||||
|
||||
static const int ourCLength[14];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -68,8 +68,8 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& font,
|
|||
const int fontWidth = font.getMaxCharWidth(),
|
||||
numchars = w / fontWidth;
|
||||
|
||||
myLabelWidth = BSPF_max(16, int(0.35 * (numchars - 12))) * fontWidth;
|
||||
myBytesWidth = 12 * fontWidth;
|
||||
_labelWidth = BSPF_max(16, int(0.35 * (numchars - 12))) * fontWidth;
|
||||
_bytesWidth = 12 * fontWidth;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Add checkboxes
|
||||
|
@ -419,6 +419,8 @@ void RomListWidget::drawWidget(bool hilite)
|
|||
// Draw the list items
|
||||
const GUI::Rect& r = getEditRect();
|
||||
const GUI::Rect& l = getLineRect();
|
||||
int large_disasmw = _w - l.x() - _labelWidth,
|
||||
small_disasmw = large_disasmw - r.width();
|
||||
xpos = _x + CheckboxWidget::boxSize() + 10; ypos = _y + 2;
|
||||
for (i = 0, pos = _currentPos; i < _rows && pos < len; i++, pos++, ypos += _fontHeight)
|
||||
{
|
||||
|
@ -430,49 +432,58 @@ void RomListWidget::drawWidget(bool hilite)
|
|||
// Draw highlighted item in a frame
|
||||
if (_highlightedItem == pos)
|
||||
{
|
||||
s.frameRect(_x + l.left - 3, _y + 1 + _fontHeight * i,
|
||||
_w - l.left, _fontHeight, kDbgColorHi);
|
||||
s.frameRect(_x + l.x() - 3, _y + 1 + _fontHeight * i,
|
||||
_w - l.x(), _fontHeight, kDbgColorHi);
|
||||
}
|
||||
|
||||
// Draw the selected item inverted, on a highlighted background.
|
||||
if (_selectedItem == pos && _hasFocus)
|
||||
{
|
||||
if (!_editMode)
|
||||
s.fillRect(_x + r.left - 3, _y + 1 + _fontHeight * i,
|
||||
s.fillRect(_x + r.x() - 3, _y + 1 + _fontHeight * i,
|
||||
r.width(), _fontHeight, kTextColorHi);
|
||||
else
|
||||
s.frameRect(_x + r.left - 3, _y + 1 + _fontHeight * i,
|
||||
s.frameRect(_x + r.x() - 3, _y + 1 + _fontHeight * i,
|
||||
r.width(), _fontHeight, kTextColorHi);
|
||||
}
|
||||
|
||||
// Draw labels
|
||||
s.drawString(_font, dlist[pos].label, xpos, ypos,
|
||||
myLabelWidth, kTextColor);
|
||||
s.drawString(_font, dlist[pos].label, xpos, ypos, _labelWidth, kTextColor);
|
||||
|
||||
// Draw disassembly
|
||||
s.drawString(_font, dlist[pos].disasm, xpos + myLabelWidth, ypos,
|
||||
r.left, kTextColor);
|
||||
|
||||
// Draw editable bytes
|
||||
if (_selectedItem == pos && _editMode)
|
||||
// Sometimes there aren't any bytes to display, in which case the disassembly
|
||||
// should get all remaining space
|
||||
if(dlist[pos].bytes != "")
|
||||
{
|
||||
adjustOffset();
|
||||
deltax = -_editScrollOffset;
|
||||
// Draw disassembly
|
||||
s.drawString(_font, dlist[pos].disasm, xpos + _labelWidth, ypos,
|
||||
small_disasmw, kTextColor);
|
||||
|
||||
s.drawString(_font, _editString, _x + r.left, ypos, r.width(), kTextColor,
|
||||
kTextAlignLeft, deltax, false);
|
||||
// Draw bytes
|
||||
{
|
||||
if (_selectedItem == pos && _editMode)
|
||||
{
|
||||
adjustOffset();
|
||||
deltax = -_editScrollOffset;
|
||||
|
||||
s.drawString(_font, _editString, _x + r.x(), ypos, r.width(), kTextColor,
|
||||
kTextAlignLeft, deltax, false);
|
||||
|
||||
drawCaret();
|
||||
}
|
||||
else
|
||||
{
|
||||
deltax = 0;
|
||||
s.drawString(_font, dlist[pos].bytes, _x + r.x(), ypos, r.width(), kTextColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
deltax = 0;
|
||||
s.drawString(_font, dlist[pos].bytes, _x + r.left, ypos, r.width(), kTextColor);
|
||||
// Draw disassembly, giving it all remaining horizontal space
|
||||
s.drawString(_font, dlist[pos].disasm, xpos + _labelWidth, ypos,
|
||||
large_disasmw, kTextColor);
|
||||
}
|
||||
}
|
||||
|
||||
// Only draw the caret while editing, and if it's in the current viewport
|
||||
if(_editMode && (_selectedItem >= myScrollBar->_currentPos) &&
|
||||
(_selectedItem < myScrollBar->_currentPos + _rows))
|
||||
drawCaret();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -483,8 +494,8 @@ GUI::Rect RomListWidget::getLineRect() const
|
|||
xoffset = CheckboxWidget::boxSize() + 10;
|
||||
r.top += yoffset;
|
||||
r.bottom += yoffset;
|
||||
r.left += xoffset;
|
||||
r.right -= xoffset - 15;
|
||||
r.left += xoffset;
|
||||
r.right -= xoffset - 15;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -496,7 +507,7 @@ GUI::Rect RomListWidget::getEditRect() const
|
|||
const int yoffset = (_selectedItem - _currentPos) * _fontHeight;
|
||||
r.top += yoffset;
|
||||
r.bottom += yoffset;
|
||||
r.left += _w - myBytesWidth;
|
||||
r.left += _w - _bytesWidth;
|
||||
r.right = _w;
|
||||
|
||||
return r;
|
||||
|
|
|
@ -88,9 +88,8 @@ class RomListWidget : public EditableWidget
|
|||
ContextMenu* myMenu;
|
||||
ScrollBarWidget* myScrollBar;
|
||||
|
||||
int myLabelWidth;
|
||||
int myBytesWidth;
|
||||
|
||||
int _labelWidth;
|
||||
int _bytesWidth;
|
||||
int _rows;
|
||||
int _cols;
|
||||
int _currentPos;
|
||||
|
|
|
@ -146,6 +146,10 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
|||
// 'id' is the line in the disassemblylist to be accessed
|
||||
// 'data' is the state of the breakpoint at 'id'
|
||||
setBreak(id, data);
|
||||
// Refresh the romlist, since the breakpoint may not have
|
||||
// actually changed
|
||||
myRomList->setDirty();
|
||||
myRomList->draw();
|
||||
break;
|
||||
|
||||
case kRLRomChangedCmd:
|
||||
|
@ -197,7 +201,7 @@ void RomWidget::setBreak(int disasm_line, bool state)
|
|||
instance().debugger().cartDebug().disassemblyList();
|
||||
if(disasm_line >= (int)list.size()) return;
|
||||
|
||||
if(list[disasm_line].address != 0)
|
||||
if(list[disasm_line].address != 0 && list[disasm_line].bytes != "")
|
||||
instance().debugger().setBreakPoint(list[disasm_line].address, state);
|
||||
}
|
||||
|
||||
|
|
|
@ -296,37 +296,31 @@ uInt8 CartridgeDPCPlus::peek(uInt16 address)
|
|||
// Switch banks if necessary
|
||||
switch(address)
|
||||
{
|
||||
case 0x0FF6:
|
||||
// Set the current bank to the first 4k bank
|
||||
bank(0);
|
||||
break;
|
||||
|
||||
case 0x0FF7:
|
||||
// Set the current bank to the second 4k bank
|
||||
bank(1);
|
||||
break;
|
||||
|
||||
case 0x0FF8:
|
||||
// Set the current bank to the third 4k bank
|
||||
bank(2);
|
||||
break;
|
||||
|
||||
case 0x0FF9:
|
||||
// Set the current bank to the fourth 4k bank
|
||||
bank(3);
|
||||
break;
|
||||
|
||||
case 0x0FFA:
|
||||
// Set the current bank to the fifth 4k bank
|
||||
bank(4);
|
||||
break;
|
||||
|
||||
case 0x0FFB:
|
||||
// Set the current bank to the last 4k bank
|
||||
bank(5);
|
||||
break;
|
||||
|
||||
default:
|
||||
case 0x0FF6:
|
||||
// Set the current bank to the first 4k bank
|
||||
bank(0);
|
||||
break;
|
||||
case 0x0FF7:
|
||||
// Set the current bank to the second 4k bank
|
||||
bank(1);
|
||||
break;
|
||||
case 0x0FF8:
|
||||
// Set the current bank to the third 4k bank
|
||||
bank(2);
|
||||
break;
|
||||
case 0x0FF9:
|
||||
// Set the current bank to the fourth 4k bank
|
||||
bank(3);
|
||||
break;
|
||||
case 0x0FFA:
|
||||
// Set the current bank to the fifth 4k bank
|
||||
bank(4);
|
||||
break;
|
||||
case 0x0FFB:
|
||||
// Set the current bank to the last 4k bank
|
||||
bank(5);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return myProgramImage[myCurrentBank * 4096 + address];
|
||||
|
@ -422,36 +416,30 @@ void CartridgeDPCPlus::poke(uInt16 address, uInt8 value)
|
|||
// Switch banks if necessary
|
||||
switch(address)
|
||||
{
|
||||
case 0x0FF6:
|
||||
// Set the current bank to the first 4k bank
|
||||
bank(0);
|
||||
break;
|
||||
|
||||
case 0x0FF7:
|
||||
// Set the current bank to the second 4k bank
|
||||
bank(1);
|
||||
break;
|
||||
|
||||
case 0x0FF8:
|
||||
// Set the current bank to the third 4k bank
|
||||
bank(2);
|
||||
break;
|
||||
|
||||
case 0x0FF9:
|
||||
// Set the current bank to the fourth 4k bank
|
||||
bank(3);
|
||||
break;
|
||||
|
||||
case 0x0FFA:
|
||||
// Set the current bank to the fifth 4k bank
|
||||
bank(4);
|
||||
break;
|
||||
|
||||
case 0x0FFB:
|
||||
// Set the current bank to the last 4k bank
|
||||
bank(5);
|
||||
break;
|
||||
|
||||
case 0x0FF6:
|
||||
// Set the current bank to the first 4k bank
|
||||
bank(0);
|
||||
break;
|
||||
case 0x0FF7:
|
||||
// Set the current bank to the second 4k bank
|
||||
bank(1);
|
||||
break;
|
||||
case 0x0FF8:
|
||||
// Set the current bank to the third 4k bank
|
||||
bank(2);
|
||||
break;
|
||||
case 0x0FF9:
|
||||
// Set the current bank to the fourth 4k bank
|
||||
bank(3);
|
||||
break;
|
||||
case 0x0FFA:
|
||||
// Set the current bank to the fifth 4k bank
|
||||
bank(4);
|
||||
break;
|
||||
case 0x0FFB:
|
||||
// Set the current bank to the last 4k bank
|
||||
bank(5);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -516,7 +504,7 @@ uInt8* CartridgeDPCPlus::getImage(int& size)
|
|||
for(i = 0; i < 4096; i++)
|
||||
myImageCopy[i + 4096 * 6] = myDisplayImage[i];
|
||||
|
||||
return &myImageCopy[0];
|
||||
return myImageCopy;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
Loading…
Reference in New Issue