And yet another set files I forgot to add. I really need to add files

as soon as I create them.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1491 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2008-04-29 19:11:42 +00:00
parent 6e51d951ef
commit 97404cde2a
2 changed files with 207 additions and 0 deletions

View File

@ -0,0 +1,132 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2008 by Bradford W. Mott and the Stella team
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: RiotWidget.cxx,v 1.1 2008-04-29 19:11:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
//============================================================================
#include "DataGridWidget.hxx"
#include "EditTextWidget.hxx"
#include "FrameBuffer.hxx"
#include "GuiObject.hxx"
#include "OSystem.hxx"
#include "RiotDebug.hxx"
#include "ToggleBitWidget.hxx"
#include "Widget.hxx"
#include "RiotWidget.hxx"
#define CREATE_IO_REGS(desc, bits, bitsID, reg) \
t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth, fontHeight, \
desc, kTextAlignLeft); \
xpos += t->getWidth() + 5; \
bits = new ToggleBitWidget(boss, font, xpos, ypos, 8, 1); \
bits->setTarget(this); \
bits->setID(bitsID); \
addFocusWidget(bits); \
xpos += bits->getWidth() + 5; \
reg = new DataGridWidget(boss, font, xpos, ypos, 1, 1, 2, 8, kBASE_16);\
reg->setTarget(this); \
reg->setEditable(false); \
addFocusWidget(reg); \
bits->setList(off, on);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h)
: Widget(boss, font, x, y, w, h),
CommandSender(boss)
{
_type = kRiotWidget;
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight();
int xpos = 10, ypos = 25, lwidth = 7 * fontWidth;
StaticTextWidget* t;
// Set the strings to be used in the various bit registers
// We only do this once because it's the state that changes, not the strings
StringList off, on;
for(int i = 0; i < 8; ++i)
{
off.push_back("0");
on.push_back("1");
}
// SWCHA bits and actual value
CREATE_IO_REGS("SWCHA:", mySWCHABits, kSWCHABitsID, mySWCHA);
// SWACNT bits and actual value
xpos = 10; ypos += lineHeight + 5;
CREATE_IO_REGS("SWACNT:", mySWACNTBits, kSWACNTBitsID, mySWACNT);
// SWCHB bits and actual value
xpos = 10; ypos += 2 * lineHeight;
CREATE_IO_REGS("SWCHB:", mySWCHBBits, kSWCHBBitsID, mySWCHB);
// SWBCNT bits and actual value
xpos = 10; ypos += lineHeight + 5;
CREATE_IO_REGS("SWBCNT:", mySWBCNTBits, kSWBCNTBitsID, mySWBCNT);
// mySWBCNTBits->setEnabled(false);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RiotWidget::~RiotWidget()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RiotWidget::loadConfig()
{
#define IO_REGS_UPDATE(bits, reg, s_bits, s_reg) \
changed.clear(); \
for(unsigned int i = 0; i < state.s_bits.size(); ++i) \
changed.push_back(state.s_bits[i] != oldstate.s_bits[i]); \
bits->setState(state.s_bits, changed); \
reg->setList(state.s_reg, oldstate.s_reg, state.s_reg != oldstate.s_reg);
IntArray alist;
IntArray vlist;
BoolArray changed;
// We push the enumerated items as addresses, and deal with the real
// address in the callback (handleCommand)
Debugger& dbg = instance()->debugger();
RiotDebug& riot = dbg.riotDebug();
const RiotState& state = (RiotState&) riot.getState();
const RiotState& oldstate = (RiotState&) riot.getOldState();
// Update the SWCHA register booleans
IO_REGS_UPDATE(mySWCHABits, mySWCHA, swchaBits, SWCHA);
// Update the SWACNT register booleans
IO_REGS_UPDATE(mySWACNTBits, mySWACNT, swacntBits, SWACNT);
// Update the SWCHB register booleans
IO_REGS_UPDATE(mySWCHBBits, mySWCHB, swchbBits, SWCHB);
// Update the SWBCNT register booleans
IO_REGS_UPDATE(mySWBCNTBits, mySWBCNT, swbcntBits, SWBCNT);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RiotWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
{
}

View File

@ -0,0 +1,75 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2008 by Bradford W. Mott and the Stella team
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: RiotWidget.hxx,v 1.1 2008-04-29 19:11:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
//============================================================================
#ifndef RIOT_WIDGET_HXX
#define RIOT_WIDGET_HXX
class GuiObject;
class ButtonWidget;
class DataGridWidget;
class EditTextWidget;
class ToggleBitWidget;
#include "Array.hxx"
#include "Widget.hxx"
#include "Command.hxx"
class RiotWidget : public Widget, public CommandSender
{
public:
RiotWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h);
virtual ~RiotWidget();
void handleCommand(CommandSender* sender, int cmd, int data, int id);
void loadConfig();
private:
private:
ToggleBitWidget* mySWCHABits;
ToggleBitWidget* mySWCHBBits;
ToggleBitWidget* mySWACNTBits;
ToggleBitWidget* mySWBCNTBits;
DataGridWidget* mySWCHA;
DataGridWidget* mySWCHB;
DataGridWidget* mySWACNT;
DataGridWidget* mySWBCNT;
DataGridWidget* myTim[4];
DataGridWidget* myTimResults[4];
EditTextWidget* myP0Dir, *myP1Dir;
EditTextWidget* myP0Diff, *myP1Diff;
EditTextWidget* myTVType;
EditTextWidget* mySwitches;
// ID's for the various widgets
// We need ID's, since there are more than one of several types of widgets
enum {
kSWCHABitsID, kSWCHBBitsID, kSWACNTBitsID, kSWBCNTBitsID,
kTim1TID, kTim8TID, kTim64TID, kTim1024TID,
kIntimID, kTimintID, kTimclksID
};
};
#endif