Added M0, M1 and BL register info to the TIA tab.

Modified NUSIZx register query, adding methods to set various bits
in those registers (nusizP0(), nusizM0(), etc).  Updated the P0/P1
TIA tab registers to use those new methods.

Fixed some bugs in TIADebug when accessing bits 4-5 in NUSIZ0/1
and CTRLPF registers.

Still TODO is collision stuff and PF0/1/2 registers.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@722 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-08-17 21:38:34 +00:00
parent 87b4f6f7f3
commit 1c0b582723
5 changed files with 511 additions and 144 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: TIADebug.cxx,v 1.19 2005-08-16 19:04:44 urchlay Exp $
// $Id: TIADebug.cxx,v 1.20 2005-08-17 21:38:34 stephena Exp $
//============================================================================
#include "System.hxx"
@ -78,13 +78,13 @@ DebuggerState& TIADebug::getState()
myState.pf.push_back(pf1());
myState.pf.push_back(pf2());
// Reflect and delay registers
myState.refP0 = refP0(); myState.vdelP0 = vdelP0();
myState.refP1 = refP1(); myState.vdelP1 = vdelP1();
// NUSIZ registers
myState.nusiz.push_back(nusiz0());
myState.nusiz.push_back(nusiz1());
// Size registers
myState.size.clear();
myState.size.push_back(nusizP0());
myState.size.push_back(nusizP1());
myState.size.push_back(nusizM0());
myState.size.push_back(nusizM1());
myState.size.push_back(sizeBL());
return myState;
}
@ -130,13 +130,13 @@ void TIADebug::saveOldState()
myOldState.pf.push_back(pf1());
myOldState.pf.push_back(pf2());
// Reflect and delay registers
myOldState.refP0 = refP0(); myOldState.vdelP0 = vdelP0();
myOldState.refP1 = refP1(); myOldState.vdelP1 = vdelP1();
// NUSIZ registers
myOldState.nusiz.push_back(nusiz0());
myOldState.nusiz.push_back(nusiz1());
// Size registers
myOldState.size.clear();
myOldState.size.push_back(nusizP0());
myOldState.size.push_back(nusizP1());
myOldState.size.push_back(nusizM0());
myOldState.size.push_back(nusizM1());
myOldState.size.push_back(sizeBL());
}
@ -170,7 +170,7 @@ void TIADebug::saveOldState()
bool TIADebug::vdelP0(int newVal)
{
if(newVal > -1)
mySystem->poke(VDELP0, ((bool)newVal));
mySystem->poke(VDELP0, ((bool)newVal));
return myTIA->myVDELP0;
}
@ -179,7 +179,7 @@ bool TIADebug::vdelP0(int newVal)
bool TIADebug::vdelP1(int newVal)
{
if(newVal > -1)
mySystem->poke(VDELP1, ((bool)newVal));
mySystem->poke(VDELP1, ((bool)newVal));
return myTIA->myVDELP1;
}
@ -188,7 +188,7 @@ bool TIADebug::vdelP1(int newVal)
bool TIADebug::vdelBL(int newVal)
{
if(newVal > -1)
mySystem->poke(VDELBL, ((bool)newVal));
mySystem->poke(VDELBL, ((bool)newVal));
return myTIA->myVDELBL;
}
@ -197,7 +197,7 @@ bool TIADebug::vdelBL(int newVal)
bool TIADebug::enaM0(int newVal)
{
if(newVal > -1)
mySystem->poke(ENAM0, ((bool)newVal) << 1);
mySystem->poke(ENAM0, ((bool)newVal) << 1);
return myTIA->myENAM0;
}
@ -206,7 +206,7 @@ bool TIADebug::enaM0(int newVal)
bool TIADebug::enaM1(int newVal)
{
if(newVal > -1)
mySystem->poke(ENAM1, ((bool)newVal) << 1);
mySystem->poke(ENAM1, ((bool)newVal) << 1);
return myTIA->myENAM1;
}
@ -215,7 +215,7 @@ bool TIADebug::enaM1(int newVal)
bool TIADebug::enaBL(int newVal)
{
if(newVal > -1)
mySystem->poke(ENABL, ((bool)newVal) << 1);
mySystem->poke(ENABL, ((bool)newVal) << 1);
return myTIA->myENABL;
}
@ -224,7 +224,7 @@ bool TIADebug::enaBL(int newVal)
bool TIADebug::resMP0(int newVal)
{
if(newVal > -1)
mySystem->poke(RESMP0, ((bool)newVal) << 1);
mySystem->poke(RESMP0, ((bool)newVal) << 1);
return myTIA->myRESMP0;
}
@ -233,7 +233,7 @@ bool TIADebug::resMP0(int newVal)
bool TIADebug::resMP1(int newVal)
{
if(newVal > -1)
mySystem->poke(RESMP1, ((bool)newVal) << 1);
mySystem->poke(RESMP1, ((bool)newVal) << 1);
return myTIA->myRESMP1;
}
@ -242,7 +242,7 @@ bool TIADebug::resMP1(int newVal)
bool TIADebug::refP0(int newVal)
{
if(newVal > -1)
mySystem->poke(REFP0, ((bool)newVal) << 3);
mySystem->poke(REFP0, ((bool)newVal) << 3);
return myTIA->myREFP0;
}
@ -251,7 +251,7 @@ bool TIADebug::refP0(int newVal)
bool TIADebug::refP1(int newVal)
{
if(newVal > -1)
mySystem->poke(REFP1, ((bool)newVal) << 3);
mySystem->poke(REFP1, ((bool)newVal) << 3);
return myTIA->myREFP1;
}
@ -260,7 +260,7 @@ bool TIADebug::refP1(int newVal)
uInt8 TIADebug::audC0(int newVal)
{
if(newVal > -1)
mySystem->poke(AUDC0, newVal);
mySystem->poke(AUDC0, newVal);
return myTIA->myAUDC0;
}
@ -269,7 +269,7 @@ uInt8 TIADebug::audC0(int newVal)
uInt8 TIADebug::audC1(int newVal)
{
if(newVal > -1)
mySystem->poke(AUDC1, newVal);
mySystem->poke(AUDC1, newVal);
return myTIA->myAUDC1;
}
@ -278,7 +278,7 @@ uInt8 TIADebug::audC1(int newVal)
uInt8 TIADebug::audV0(int newVal)
{
if(newVal > -1)
mySystem->poke(AUDV0, newVal);
mySystem->poke(AUDV0, newVal);
return myTIA->myAUDV0;
}
@ -287,7 +287,7 @@ uInt8 TIADebug::audV0(int newVal)
uInt8 TIADebug::audV1(int newVal)
{
if(newVal > -1)
mySystem->poke(AUDV1, newVal);
mySystem->poke(AUDV1, newVal);
return myTIA->myAUDV1;
}
@ -296,7 +296,7 @@ uInt8 TIADebug::audV1(int newVal)
uInt8 TIADebug::audF0(int newVal)
{
if(newVal > -1)
mySystem->poke(AUDF0, newVal);
mySystem->poke(AUDF0, newVal);
return myTIA->myAUDF0;
}
@ -305,7 +305,7 @@ uInt8 TIADebug::audF0(int newVal)
uInt8 TIADebug::audF1(int newVal)
{
if(newVal > -1)
mySystem->poke(AUDF1, newVal);
mySystem->poke(AUDF1, newVal);
return myTIA->myAUDF1;
}
@ -314,7 +314,7 @@ uInt8 TIADebug::audF1(int newVal)
uInt8 TIADebug::pf0(int newVal)
{
if(newVal > -1)
mySystem->poke(PF0, newVal << 4);
mySystem->poke(PF0, newVal << 4);
return myTIA->myPF & 0x0f;
}
@ -323,7 +323,7 @@ uInt8 TIADebug::pf0(int newVal)
uInt8 TIADebug::pf1(int newVal)
{
if(newVal > -1)
mySystem->poke(PF1, newVal);
mySystem->poke(PF1, newVal);
return (myTIA->myPF & 0xff0) >> 4;
}
@ -332,7 +332,7 @@ uInt8 TIADebug::pf1(int newVal)
uInt8 TIADebug::pf2(int newVal)
{
if(newVal > -1)
mySystem->poke(PF2, newVal);
mySystem->poke(PF2, newVal);
return (myTIA->myPF & 0xff000) >> 12;
}
@ -341,7 +341,7 @@ uInt8 TIADebug::pf2(int newVal)
uInt8 TIADebug::coluP0(int newVal)
{
if(newVal > -1)
mySystem->poke(COLUP0, newVal);
mySystem->poke(COLUP0, newVal);
return myTIA->myCOLUP0 & 0xff;
}
@ -350,7 +350,7 @@ uInt8 TIADebug::coluP0(int newVal)
uInt8 TIADebug::coluP1(int newVal)
{
if(newVal > -1)
mySystem->poke(COLUP0, newVal);
mySystem->poke(COLUP1, newVal);
return myTIA->myCOLUP1 & 0xff;
}
@ -359,7 +359,7 @@ uInt8 TIADebug::coluP1(int newVal)
uInt8 TIADebug::coluPF(int newVal)
{
if(newVal > -1)
mySystem->poke(COLUPF, newVal);
mySystem->poke(COLUPF, newVal);
return myTIA->myCOLUPF & 0xff;
}
@ -368,7 +368,7 @@ uInt8 TIADebug::coluPF(int newVal)
uInt8 TIADebug::coluBK(int newVal)
{
if(newVal > -1)
mySystem->poke(COLUBK, newVal);
mySystem->poke(COLUBK, newVal);
return myTIA->myCOLUBK & 0xff;
}
@ -377,7 +377,7 @@ uInt8 TIADebug::coluBK(int newVal)
uInt8 TIADebug::nusiz0(int newVal)
{
if(newVal > -1)
mySystem->poke(NUSIZ0, newVal);
mySystem->poke(NUSIZ0, newVal);
return myTIA->myNUSIZ0;
}
@ -386,11 +386,63 @@ uInt8 TIADebug::nusiz0(int newVal)
uInt8 TIADebug::nusiz1(int newVal)
{
if(newVal > -1)
mySystem->poke(NUSIZ1, newVal);
mySystem->poke(NUSIZ1, newVal);
return myTIA->myNUSIZ1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 TIADebug::nusizP0(int newVal)
{
if(newVal > -1)
{
uInt8 tmp = myTIA->myNUSIZ0 & ~0x07;
tmp |= (newVal & 0x07);
mySystem->poke(NUSIZ0, tmp);
}
return myTIA->myNUSIZ0 & 0x07;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 TIADebug::nusizP1(int newVal)
{
if(newVal > -1)
{
uInt8 tmp = myTIA->myNUSIZ1 & ~0x07;
tmp |= newVal & 0x07;
mySystem->poke(NUSIZ1, tmp);
}
return myTIA->myNUSIZ1 & 0x07;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 TIADebug::nusizM0(int newVal)
{
if(newVal > -1)
{
uInt8 tmp = myTIA->myNUSIZ0 & ~0x30;
tmp |= (newVal & 0x04) << 4;
mySystem->poke(NUSIZ0, tmp);
}
return (myTIA->myNUSIZ0 & 0x30) >> 4;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 TIADebug::nusizM1(int newVal)
{
if(newVal > -1)
{
uInt8 tmp = myTIA->myNUSIZ1 & ~0x30;
tmp |= (newVal & 0x04) << 4;
mySystem->poke(NUSIZ1, tmp);
}
return (myTIA->myNUSIZ1 & 0x30) >> 4;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 TIADebug::grP0(int newVal)
{
@ -459,16 +511,29 @@ uInt8 TIADebug::posBL(int newVal)
uInt8 TIADebug::ctrlPF(int newVal)
{
if(newVal > -1)
mySystem->poke(CTRLPF, newVal);
mySystem->poke(CTRLPF, newVal);
return myTIA->myCTRLPF;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 TIADebug::sizeBL(int newVal)
{
if(newVal > -1)
{
uInt8 tmp = myTIA->myCTRLPF & ~0x30;
tmp |= (newVal & 0x04) << 4;
mySystem->poke(CTRLPF, tmp);
}
return (myTIA->myCTRLPF & 0x30) >> 4;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 TIADebug::hmP0(int newVal)
{
if(newVal > -1)
mySystem->poke(HMP0, newVal << 4);
mySystem->poke(HMP0, newVal << 4);
return myTIA->myHMP0;
}
@ -477,7 +542,7 @@ uInt8 TIADebug::hmP0(int newVal)
uInt8 TIADebug::hmP1(int newVal)
{
if(newVal > -1)
mySystem->poke(HMP1, newVal << 4);
mySystem->poke(HMP1, newVal << 4);
return myTIA->myHMP1;
}
@ -486,7 +551,7 @@ uInt8 TIADebug::hmP1(int newVal)
uInt8 TIADebug::hmM0(int newVal)
{
if(newVal > -1)
mySystem->poke(HMM0, newVal << 4);
mySystem->poke(HMM0, newVal << 4);
return myTIA->myHMM0;
}
@ -495,7 +560,7 @@ uInt8 TIADebug::hmM0(int newVal)
uInt8 TIADebug::hmM1(int newVal)
{
if(newVal > -1)
mySystem->poke(HMM1, newVal << 4);
mySystem->poke(HMM1, newVal << 4);
return myTIA->myHMM1;
}
@ -504,7 +569,7 @@ uInt8 TIADebug::hmM1(int newVal)
uInt8 TIADebug::hmBL(int newVal)
{
if(newVal > -1)
mySystem->poke(HMBL, newVal << 4);
mySystem->poke(HMBL, newVal << 4);
return myTIA->myHMBL;
}
@ -597,15 +662,6 @@ string TIADebug::state()
TiaState state = (TiaState&) getState();
// FIXME - change tracking TiaState oldstate = (TiaState&) getOldState();
// calculate sizes
uInt8 ballSize = 1 << (myTIA->myCTRLPF & 0x18);
uInt8 m0Size = 1 << (myTIA->myNUSIZ0 & 0x18);
uInt8 m1Size = 1 << (myTIA->myNUSIZ1 & 0x18);
// easier to use a table for these:
const string& p0Size = nusiz0String();
const string& p1Size = nusiz1String();
// build up output, then return it.
ret += "scanline ";
@ -664,11 +720,11 @@ string TIADebug::state()
ret += " HM=";
ret += myDebugger->valueToString(state.hm[P0]);
ret += " ";
ret += p0Size;
ret += nusizP0String();
ret += " ";
ret += booleanWithLabel("reflect", state.refP0);
ret += booleanWithLabel("reflect", refP0());
ret += " ";
ret += booleanWithLabel("delay", state.vdelP0);
ret += booleanWithLabel("delay", vdelP0());
ret += "\n";
ret += "P1: GR=";
@ -680,11 +736,11 @@ string TIADebug::state()
ret += " HM=";
ret += myDebugger->valueToString(state.hm[P1]);
ret += " ";
ret += p1Size;
ret += nusizP1String();
ret += " ";
ret += booleanWithLabel("reflect", state.refP1);
ret += booleanWithLabel("reflect", refP1());
ret += " ";
ret += booleanWithLabel("delay", state.vdelP1);
ret += booleanWithLabel("delay", vdelP1());
ret += "\n";
ret += "M0: ";
@ -694,9 +750,9 @@ string TIADebug::state()
ret += " HM=";
ret += myDebugger->valueToString(state.hm[M0]);
ret += " size=";
ret += myDebugger->valueToString(m0Size);
ret += myDebugger->valueToString(state.size[M0]);
ret += " ";
ret += booleanWithLabel("reset", (myTIA->myRESMP0));
ret += booleanWithLabel("reset", resMP0());
ret += "\n";
ret += "M1: ";
@ -706,9 +762,9 @@ string TIADebug::state()
ret += " HM=";
ret += myDebugger->valueToString(state.hm[M1]);
ret += " size=";
ret += myDebugger->valueToString(m1Size);
ret += myDebugger->valueToString(state.size[M1]);
ret += " ";
ret += booleanWithLabel("reset", (myTIA->myRESMP1));
ret += booleanWithLabel("reset", resMP1());
ret += "\n";
ret += "BL: ";
@ -718,9 +774,9 @@ string TIADebug::state()
ret += " HM=";
ret += myDebugger->valueToString(state.hm[BL]);
ret += " size=";
ret += myDebugger->valueToString(ballSize);
ret += myDebugger->valueToString(state.size[BL]);
ret += " ";
ret += booleanWithLabel("delay", (myTIA->myVDELBL));
ret += booleanWithLabel("delay", vdelBL());
ret += "\n";
ret += "PF0: ";
@ -785,11 +841,11 @@ string TIADebug::state()
ret += audFreq(myTIA->myAUDF1);
ret += " ";
ret += "AUDC0: ";
ret += "AUDC1: ";
ret += myDebugger->valueToString(myTIA->myAUDC1);
ret += " ";
ret += "AUDV0: ";
ret += "AUDV1: ";
ret += myDebugger->valueToString(myTIA->myAUDV1);
//ret += "\n";

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: TIADebug.hxx,v 1.16 2005-08-16 18:34:12 stephena Exp $
// $Id: TIADebug.hxx,v 1.17 2005-08-17 21:38:34 stephena Exp $
//============================================================================
#ifndef TIA_DEBUG_HXX
@ -95,10 +95,7 @@ class TiaState : public DebuggerState
IntArray pos;
IntArray hm;
IntArray pf;
IntArray nusiz;
bool refP0, vdelP0;
bool refP1, vdelP1;
IntArray size;
};
class TIADebug : public DebuggerSystem
@ -114,14 +111,19 @@ class TIADebug : public DebuggerSystem
/* TIA byte (or part of a byte) registers */
uInt8 nusiz0(int newVal = -1);
uInt8 nusiz1(int newVal = -1);
const string& nusiz0String() { return nusizStrings[myTIA->myNUSIZ0 & 0x07]; }
const string& nusiz1String() { return nusizStrings[myTIA->myNUSIZ1 & 0x07]; }
uInt8 nusizP0(int newVal = -1);
uInt8 nusizP1(int newVal = -1);
uInt8 nusizM0(int newVal = -1);
uInt8 nusizM1(int newVal = -1);
const string& nusizP0String() { return nusizStrings[nusizP0()]; }
const string& nusizP1String() { return nusizStrings[nusizP1()]; }
uInt8 coluP0(int newVal = -1);
uInt8 coluP1(int newVal = -1);
uInt8 coluPF(int newVal = -1);
uInt8 coluBK(int newVal = -1);
uInt8 sizeBL(int newVal = -1);
uInt8 ctrlPF(int newVal = -1);
uInt8 pf0(int newVal = -1);
@ -162,6 +164,8 @@ class TIADebug : public DebuggerSystem
bool resMP0(int newVal = -1);
bool resMP1(int newVal = -1);
/* TIA strobe registers */
void strobeWsync() { mySystem->poke(WSYNC, 0); }
void strobeRsync() { mySystem->poke(RSYNC, 0); } // not emulated!

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: TiaWidget.cxx,v 1.6 2005-08-16 18:34:12 stephena Exp $
// $Id: TiaWidget.cxx,v 1.7 2005-08-17 21:38:34 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -36,18 +36,18 @@
enum {
kRamID,
kColorRegsID,
kGRP0ID,
kGRP1ID,
kPosP0ID,
kPosP1ID,
kHMP0ID,
kHMP1ID,
kRefP0ID,
kRefP1ID,
kDelP0ID,
kDelP1ID,
kNusizP0ID,
kNusizP1ID
kGRP0ID, kGRP1ID,
kPosP0ID, kPosP1ID,
kPosM0ID, kPosM1ID, kPosBLID,
kHMP0ID, kHMP1ID,
kHMM0ID, kHMM1ID, kHMBLID,
kRefP0ID, kRefP1ID,
kDelP0ID, kDelP1ID, kDelBLID,
kNusizP0ID, kNusizP1ID,
kNusizM0ID, kNusizM1ID, kSizeBLID,
kEnaM0ID, kEnaM1ID, kEnaBLID,
kResM0ID, kResM1ID
};
// Color registers
@ -174,7 +174,7 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
xpos = 10; ypos += 2*lineHeight;
t = new StaticTextWidget(boss, xpos, ypos+2,
7*fontWidth, fontHeight,
"P0/ GR:", kTextAlignLeft);
"P0: GR:", kTextAlignLeft);
t->setFont(font);
xpos += 7*fontWidth + 5;
myGRP0 = new ToggleBitWidget(boss, font, xpos, ypos, 8, 1);
@ -210,37 +210,37 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
addFocusWidget(myHMP0);
// P0 reflect and delay
xpos += myHMP0->getWidth() + 10;
xpos += myHMP0->getWidth() + 15;
myRefP0 = new CheckboxWidget(boss, font, xpos, ypos+1, "Reflect", kCheckActionCmd);
myRefP0->setFont(font);
myRefP0->setTarget(this);
myRefP0->setID(kRefP0ID);
addFocusWidget(myRefP0);
xpos += myRefP0->getWidth() + 10;
xpos += myRefP0->getWidth() + 15;
myDelP0 = new CheckboxWidget(boss, font, xpos, ypos+1, "Delay", kCheckActionCmd);
myDelP0->setFont(font);
myDelP0->setTarget(this);
myDelP0->setID(kDelP0ID);
addFocusWidget(myDelP0);
// NUSIZ0
// NUSIZ0 (player portion)
xpos = 10 + lwidth; ypos += myGRP0->getHeight() + 2;
t = new StaticTextWidget(boss, xpos, ypos+2,
7*fontWidth, fontHeight,
"NUSIZ0:", kTextAlignLeft);
8*fontWidth, fontHeight,
"NusizP0:", kTextAlignLeft);
t->setFont(font);
xpos += 7*fontWidth + 5;
myNusiz0 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 1, 3, kBASE_16_4);
myNusiz0->setTarget(this);
myNusiz0->setID(kNusizP0ID);
addFocusWidget(myNusiz0);
xpos += 8*fontWidth + 5;
myNusizP0 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 1, 3, kBASE_16_4);
myNusizP0->setTarget(this);
myNusizP0->setID(kNusizP0ID);
addFocusWidget(myNusizP0);
xpos += myNusiz0->getWidth() + 5;
myNusiz0Text = new EditTextWidget(boss, xpos, ypos+1, 23*fontWidth, lineHeight, "");
myNusiz0Text->setFont(font);
myNusiz0Text->setEditable(false);
xpos += myNusizP0->getWidth() + 5;
myNusizP0Text = new EditTextWidget(boss, xpos, ypos+1, 23*fontWidth, lineHeight, "");
myNusizP0Text->setFont(font);
myNusizP0Text->setEditable(false);
////////////////////////////
// P1 register info
@ -249,7 +249,7 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
xpos = 10; ypos += 2*lineHeight;
t = new StaticTextWidget(boss, xpos, ypos+2,
7*fontWidth, fontHeight,
"P1/ GR:", kTextAlignLeft);
"P1: GR:", kTextAlignLeft);
t->setFont(font);
xpos += 7*fontWidth + 5;
myGRP1 = new ToggleBitWidget(boss, font, xpos, ypos, 8, 1);
@ -285,38 +285,226 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
addFocusWidget(myHMP1);
// P1 reflect and delay
xpos += myHMP1->getWidth() + 10;
xpos += myHMP1->getWidth() + 15;
myRefP1 = new CheckboxWidget(boss, font, xpos, ypos+1, "Reflect", kCheckActionCmd);
myRefP1->setFont(font);
myRefP1->setTarget(this);
myRefP1->setID(kRefP1ID);
addFocusWidget(myRefP1);
xpos += myRefP1->getWidth() + 10;
xpos += myRefP1->getWidth() + 15;
myDelP1 = new CheckboxWidget(boss, font, xpos, ypos+1, "Delay", kCheckActionCmd);
myDelP1->setFont(font);
myDelP1->setTarget(this);
myDelP1->setID(kDelP1ID);
addFocusWidget(myDelP1);
// NUSIZ1
// NUSIZ1 (player portion)
xpos = 10 + lwidth; ypos += myGRP1->getHeight() + 2;
t = new StaticTextWidget(boss, xpos, ypos+2,
7*fontWidth, fontHeight,
"NUSIZ1:", kTextAlignLeft);
8*fontWidth, fontHeight,
"NusizP1:", kTextAlignLeft);
t->setFont(font);
xpos += 7*fontWidth + 5;
myNusiz1 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 1, 3, kBASE_16_4);
myNusiz1->setTarget(this);
myNusiz1->setID(kNusizP1ID);
addFocusWidget(myNusiz1);
xpos += 8*fontWidth + 5;
myNusizP1 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 1, 3, kBASE_16_4);
myNusizP1->setTarget(this);
myNusizP1->setID(kNusizP1ID);
addFocusWidget(myNusizP1);
xpos += myNusiz1->getWidth() + 5;
myNusiz1Text = new EditTextWidget(boss, xpos, ypos+1, 23*fontWidth, lineHeight, "");
myNusiz1Text->setFont(font);
myNusiz1Text->setEditable(false);
xpos += myNusizP1->getWidth() + 5;
myNusizP1Text = new EditTextWidget(boss, xpos, ypos+1, 23*fontWidth, lineHeight, "");
myNusizP1Text->setFont(font);
myNusizP1Text->setEditable(false);
////////////////////////////
// M0 register info
////////////////////////////
// enaM0
xpos = 10; ypos += 2*lineHeight;
t = new StaticTextWidget(boss, xpos, ypos+2,
3*fontWidth, fontHeight,
"M0:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 8;
myEnaM0 = new CheckboxWidget(boss, font, xpos, ypos+2, "Enable", kCheckActionCmd);
myEnaM0->setFont(font);
myEnaM0->setTarget(this);
myEnaM0->setID(kEnaM0ID);
addFocusWidget(myEnaM0);
// posM0
xpos += myEnaM0->getWidth() + 12;
t = new StaticTextWidget(boss, xpos, ypos+2,
4*fontWidth, fontHeight,
"Pos:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth + 5;
myPosM0 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 2, 8, kBASE_16);
myPosM0->setTarget(this);
myPosM0->setID(kPosM0ID);
addFocusWidget(myPosM0);
// hmM0
xpos += myPosM0->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2,
3*fontWidth, fontHeight,
"HM:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 5;
myHMM0 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 1, 4, kBASE_16_4);
myHMM0->setTarget(this);
myHMM0->setID(kHMM0ID);
addFocusWidget(myHMM0);
// NUSIZ0 (missile portion)
xpos += myHMM0->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2,
5*fontWidth, fontHeight,
"Size:", kTextAlignLeft);
t->setFont(font);
xpos += 5*fontWidth + 5;
myNusizM0 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 1, 2, kBASE_16_4);
myNusizM0->setTarget(this);
myNusizM0->setID(kNusizM0ID);
addFocusWidget(myNusizM0);
// M0 reset
xpos += myNusizM0->getWidth() + 15;
myResM0 = new CheckboxWidget(boss, font, xpos, ypos+1, "Reset", kCheckActionCmd);
myResM0->setFont(font);
myResM0->setTarget(this);
myResM0->setID(kResM0ID);
addFocusWidget(myResM0);
////////////////////////////
// M1 register info
////////////////////////////
// enaM1
xpos = 10; ypos += 2*lineHeight;
t = new StaticTextWidget(boss, xpos, ypos+2,
3*fontWidth, fontHeight,
"M1:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 8;
myEnaM1 = new CheckboxWidget(boss, font, xpos, ypos+2, "Enable", kCheckActionCmd);
myEnaM1->setFont(font);
myEnaM1->setTarget(this);
myEnaM1->setID(kEnaM1ID);
addFocusWidget(myEnaM1);
// posM0
xpos += myEnaM1->getWidth() + 12;
t = new StaticTextWidget(boss, xpos, ypos+2,
4*fontWidth, fontHeight,
"Pos:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth + 5;
myPosM1 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 2, 8, kBASE_16);
myPosM1->setTarget(this);
myPosM1->setID(kPosM1ID);
addFocusWidget(myPosM1);
// hmM0
xpos += myPosM1->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2,
3*fontWidth, fontHeight,
"HM:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 5;
myHMM1 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 1, 4, kBASE_16_4);
myHMM1->setTarget(this);
myHMM1->setID(kHMM1ID);
addFocusWidget(myHMM1);
// NUSIZ1 (missile portion)
xpos += myHMM1->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2,
5*fontWidth, fontHeight,
"Size:", kTextAlignLeft);
t->setFont(font);
xpos += 5*fontWidth + 5;
myNusizM1 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 1, 2, kBASE_16_4);
myNusizM1->setTarget(this);
myNusizM1->setID(kNusizM1ID);
addFocusWidget(myNusizM1);
// M1 reset
xpos += myNusizM1->getWidth() + 15;
myResM1 = new CheckboxWidget(boss, font, xpos, ypos+1, "Reset", kCheckActionCmd);
myResM1->setFont(font);
myResM1->setTarget(this);
myResM1->setID(kResM1ID);
addFocusWidget(myResM1);
////////////////////////////
// BL register info
////////////////////////////
// enaBL
xpos = 10; ypos += 2*lineHeight;
t = new StaticTextWidget(boss, xpos, ypos+2,
3*fontWidth, fontHeight,
"BL:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 8;
myEnaBL = new CheckboxWidget(boss, font, xpos, ypos+2, "Enable", kCheckActionCmd);
myEnaBL->setFont(font);
myEnaBL->setTarget(this);
myEnaBL->setID(kEnaBLID);
addFocusWidget(myEnaBL);
// posBL
xpos += myEnaBL->getWidth() + 12;
t = new StaticTextWidget(boss, xpos, ypos+2,
4*fontWidth, fontHeight,
"Pos:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth + 5;
myPosBL = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 2, 8, kBASE_16);
myPosBL->setTarget(this);
myPosBL->setID(kPosBLID);
addFocusWidget(myPosBL);
// hmBL
xpos += myPosBL->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2,
3*fontWidth, fontHeight,
"HM:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 5;
myHMBL = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 1, 4, kBASE_16_4);
myHMBL->setTarget(this);
myHMBL->setID(kHMBLID);
addFocusWidget(myHMBL);
// CTRLPF (size portion)
xpos += myHMBL->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2,
5*fontWidth, fontHeight,
"Size:", kTextAlignLeft);
t->setFont(font);
xpos += 5*fontWidth + 5;
mySizeBL = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 1, 2, kBASE_16_4);
mySizeBL->setTarget(this);
mySizeBL->setID(kSizeBLID);
addFocusWidget(mySizeBL);
// BL delay
xpos += mySizeBL->getWidth() + 15;
myDelBL = new CheckboxWidget(boss, font, xpos, ypos+1, "Delay", kCheckActionCmd);
myDelBL->setFont(font);
myDelBL->setTarget(this);
myDelBL->setID(kDelBLID);
addFocusWidget(myDelBL);
}
@ -354,6 +542,18 @@ void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
tia.posP1(myPosP1->getSelectedValue());
break;
case kPosM0ID:
tia.posM0(myPosM0->getSelectedValue());
break;
case kPosM1ID:
tia.posM1(myPosM1->getSelectedValue());
break;
case kPosBLID:
tia.posBL(myPosBL->getSelectedValue());
break;
case kHMP0ID:
tia.hmP0(myHMP0->getSelectedValue());
break;
@ -362,14 +562,38 @@ void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
tia.hmP1(myHMP1->getSelectedValue());
break;
case kHMM0ID:
tia.hmM0(myHMM0->getSelectedValue());
break;
case kHMM1ID:
tia.hmM1(myHMM1->getSelectedValue());
break;
case kHMBLID:
tia.hmBL(myHMBL->getSelectedValue());
break;
case kNusizP0ID:
tia.nusiz0(myNusiz0->getSelectedValue());
myNusiz0Text->setEditString(tia.nusiz0String());
tia.nusizP0(myNusizP0->getSelectedValue());
myNusizP0Text->setEditString(tia.nusizP0String());
break;
case kNusizP1ID:
tia.nusiz1(myNusiz1->getSelectedValue());
myNusiz1Text->setEditString(tia.nusiz1String());
tia.nusizP1(myNusizP1->getSelectedValue());
myNusizP1Text->setEditString(tia.nusizP1String());
break;
case kNusizM0ID:
tia.nusizM0(myNusizM0->getSelectedValue());
break;
case kNusizM1ID:
tia.nusizM1(myNusizM1->getSelectedValue());
break;
case kSizeBLID:
tia.sizeBL(mySizeBL->getSelectedValue());
break;
default:
@ -426,6 +650,18 @@ void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
case kDelP1ID:
tia.vdelP1(myDelP1->getState() ? 1 : 0);
break;
case kDelBLID:
tia.vdelBL(myDelBL->getState() ? 1 : 0);
break;
case kResM0ID:
tia.resMP0(myResM0->getState() ? 1 : 0);
break;
case kResM1ID:
tia.resMP1(myResM1->getState() ? 1 : 0);
break;
}
break;
}
@ -492,16 +728,16 @@ void TiaWidget::fillGrid()
// posP0
myPosP0->setList(0, state.pos[P0], state.pos[P0] != oldstate.pos[P0]);
// hmP0 register
// hmP0
myHMP0->setList(0, state.hm[P0], state.hm[P0] != oldstate.hm[P0]);
// refP0 & vdelP0
myRefP0->setState(state.refP0);
myDelP0->setState(state.vdelP0);
myRefP0->setState(tia.refP0());
myDelP0->setState(tia.vdelP0());
// NUSIZ0
myNusiz0->setList(0, state.nusiz[0], state.nusiz[0] != oldstate.nusiz[0]);
myNusiz0Text->setEditString(tia.nusiz0String());
// NUSIZ0 (player portion)
myNusizP0->setList(0, state.size[P0], state.size[P0] != oldstate.size[P0]);
myNusizP0Text->setEditString(tia.nusizP0String());
////////////////////////////
// P1 register info
@ -520,16 +756,70 @@ void TiaWidget::fillGrid()
// posP1
myPosP1->setList(0, state.pos[P1], state.pos[P1] != oldstate.pos[P1]);
// hmP1 register
// hmP1
myHMP1->setList(0, state.hm[P1], state.hm[P1] != oldstate.hm[P1]);
// refP1 & vdelP1
myRefP1->setState(state.refP1);
myDelP1->setState(state.vdelP1);
myRefP1->setState(tia.refP1());
myDelP1->setState(tia.vdelP1());
// NUSIZ1
myNusiz1->setList(0, state.nusiz[1], state.nusiz[1] != oldstate.nusiz[1]);
myNusiz1Text->setEditString(tia.nusiz1String());
// NUSIZ1 (player portion)
myNusizP1->setList(0, state.size[P1], state.size[P1] != oldstate.size[P1]);
myNusizP1Text->setEditString(tia.nusizP1String());
////////////////////////////
// M0 register info
////////////////////////////
// enaM0
myEnaM0->setState(tia.enaM0());
// posM0
myPosM0->setList(0, state.pos[M0], state.pos[M0] != oldstate.pos[M0]);
// hmM0
myHMM0->setList(0, state.hm[M0], state.hm[M0] != oldstate.hm[M0]);
// NUSIZ0 (missile portion)
myNusizM0->setList(0, state.size[M0], state.size[M0] != oldstate.size[M0]);
// resMP0
myResM0->setState(tia.resMP0());
////////////////////////////
// M1 register info
////////////////////////////
// enaM1
myEnaM1->setState(tia.enaM1());
// posM1
myPosM1->setList(0, state.pos[M1], state.pos[M1] != oldstate.pos[M1]);
// hmM1
myHMM1->setList(0, state.hm[M1], state.hm[M1] != oldstate.hm[M1]);
// NUSIZ1 (missile portion)
myNusizM1->setList(0, state.size[M1], state.size[M1] != oldstate.size[M1]);
// resMP1
myResM1->setState(tia.resMP1());
////////////////////////////
// BL register info
////////////////////////////
// enaBL
myEnaBL->setState(tia.enaBL());
// posBL
myPosBL->setList(0, state.pos[BL], state.pos[BL] != oldstate.pos[BL]);
// hmBL
myHMBL->setList(0, state.hm[BL], state.hm[BL] != oldstate.hm[BL]);
// CTRLPF (size portion)
mySizeBL->setList(0, state.size[BL], state.size[BL] != oldstate.size[BL]);
// vdelBL
myDelBL->setState(tia.vdelBL());
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: TiaWidget.hxx,v 1.4 2005-08-16 18:34:12 stephena Exp $
// $Id: TiaWidget.hxx,v 1.5 2005-08-17 21:38:34 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -67,19 +67,36 @@ class TiaWidget : public Widget, public CommandSender
DataGridWidget* myPosP0;
DataGridWidget* myPosP1;
DataGridWidget* myPosM0;
DataGridWidget* myPosM1;
DataGridWidget* myPosBL;
DataGridWidget* myHMP0;
DataGridWidget* myHMP1;
DataGridWidget* myHMM0;
DataGridWidget* myHMM1;
DataGridWidget* myHMBL;
DataGridWidget* myNusiz0;
DataGridWidget* myNusiz1;
EditTextWidget* myNusiz0Text;
EditTextWidget* myNusiz1Text;
DataGridWidget* myNusizP0;
DataGridWidget* myNusizP1;
DataGridWidget* myNusizM0;
DataGridWidget* myNusizM1;
DataGridWidget* mySizeBL;
EditTextWidget* myNusizP0Text;
EditTextWidget* myNusizP1Text;
CheckboxWidget* myRefP0;
CheckboxWidget* myRefP1;
CheckboxWidget* myDelP0;
CheckboxWidget* myDelP1;
CheckboxWidget* myDelBL;
CheckboxWidget* myEnaM0;
CheckboxWidget* myEnaM1;
CheckboxWidget* myEnaBL;
CheckboxWidget* myResM0;
CheckboxWidget* myResM1;
};
#endif

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: ToggleBitWidget.cxx,v 1.8 2005-08-12 17:12:43 stephena Exp $
// $Id: ToggleBitWidget.cxx,v 1.9 2005-08-17 21:38:34 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -250,7 +250,7 @@ void ToggleBitWidget::handleCommand(CommandSender* sender, int cmd,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ToggleBitWidget::drawWidget(bool hilite)
{
cerr << "ToggleBitWidget::drawWidget\n";
//cerr << "ToggleBitWidget::drawWidget\n";
FrameBuffer& fb = instance()->frameBuffer();
int row, col;
string buffer;