~ubuntu-branches/debian/squeeze/stella/squeeze

« back to all changes in this revision

Viewing changes to src/debugger/DebuggerExpressions.hxx

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Kitt
  • Date: 2010-07-12 23:49:36 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100712234936-juawrr3etzhr2qpv
Tags: 3.1.2-1
* New maintainer (closes: #532039).
* New upstream version (closes: #461121):
  - includes launcher (closes: #396058).
* Fix the reference to the X Window System in the description (closes:
  #411815).
* Move to main, DFSG-free ROMs are available (see README.Debian).
* Enhance the package description.
* Drop the libslang2-dev dependency (closes: #560274).
* Remove the Encoding entry from stella.desktop.
* Avoid ignoring errors when cleaning.
* Add ${misc:Depends} to the package dependencies.
* Provide a doc-base file to install the documentation using doc-base.
* Switch to debhelper 7 with a simplified rules file.
* Use autotools-dev to provide updated configuration files.
* Update to Standards-Version 3.9.0:
  - Move to menu section Applications/Emulators.
  - Move the homepage declaration.
* Re-write the manpage.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
//  SS  SS   tt   ee      ll   ll  aa  aa
9
9
//   SSSS     ttt  eeeee llll llll  aaaaa
10
10
//
11
 
// Copyright (c) 1995-2008 by Bradford W. Mott and the Stella team
 
11
// Copyright (c) 1995-2010 by Bradford W. Mott, Stephen Anthony
 
12
// and the Stella Team
12
13
//
13
 
// See the file "license" for information on usage and redistribution of
 
14
// See the file "License.txt" for information on usage and redistribution of
14
15
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
15
16
//
16
 
// $Id: DebuggerExpressions.hxx,v 1.4 2008/03/23 17:43:21 stephena Exp $
 
17
// $Id: DebuggerExpressions.hxx 2001 2010-04-10 21:37:23Z stephena $
17
18
//============================================================================
18
19
 
19
20
#ifndef DEBUGGER_EXPRESSIONS_HXX
20
21
#define DEBUGGER_EXPRESSIONS_HXX
21
22
 
22
23
#include "bspf.hxx"
 
24
#include "CartDebug.hxx"
23
25
#include "CpuDebug.hxx"
 
26
#include "TIADebug.hxx"
24
27
#include "Debugger.hxx"
25
 
#include "TIADebug.hxx"
26
28
#include "Expression.hxx"
27
29
 
28
30
/**
35
37
{
36
38
  public:
37
39
    BinAndExpression(Expression* left, Expression* right) : Expression(left, right) {}
38
 
    uInt16 evaluate() { return myLHS->evaluate() & myRHS->evaluate(); }
 
40
    uInt16 evaluate() const
 
41
      { return myLHS->evaluate() & myRHS->evaluate(); }
39
42
};
40
43
 
41
44
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
43
46
{
44
47
  public:
45
48
    BinNotExpression(Expression* left) : Expression(left, 0) {}
46
 
    uInt16 evaluate() { return ~(myLHS->evaluate()); }
 
49
    uInt16 evaluate() const
 
50
      { return ~(myLHS->evaluate()); }
47
51
};
48
52
 
49
53
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
51
55
{
52
56
  public:
53
57
    BinOrExpression(Expression* left, Expression* right) : Expression(left, right) {}
54
 
    uInt16 evaluate() { return myLHS->evaluate() | myRHS->evaluate(); }
 
58
    uInt16 evaluate() const
 
59
      { return myLHS->evaluate() | myRHS->evaluate(); }
55
60
};
56
61
 
57
62
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
59
64
{
60
65
  public:
61
66
    BinXorExpression(Expression* left, Expression* right) : Expression(left, right) {}
62
 
    uInt16 evaluate() { return myLHS->evaluate() ^ myRHS->evaluate(); }
 
67
    uInt16 evaluate() const
 
68
      { return myLHS->evaluate() ^ myRHS->evaluate(); }
63
69
};
64
70
 
65
71
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
67
73
{
68
74
  public:
69
75
    ByteDerefExpression(Expression* left): Expression(left, 0) {}
70
 
    uInt16 evaluate() { return Debugger::debugger().peek(myLHS->evaluate()); }
 
76
    uInt16 evaluate() const
 
77
      { return Debugger::debugger().peek(myLHS->evaluate()); }
71
78
};
72
79
 
73
80
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
75
82
{
76
83
  public:
77
84
    ByteDerefOffsetExpression(Expression* left, Expression* right) : Expression(left, right) {}
78
 
    uInt16 evaluate() { return Debugger::debugger().peek(myLHS->evaluate() + myRHS->evaluate()); }
 
85
    uInt16 evaluate() const
 
86
      { return Debugger::debugger().peek(myLHS->evaluate() + myRHS->evaluate()); }
79
87
};
80
88
 
81
89
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
83
91
{
84
92
  public:
85
93
    ConstExpression(const int value) : Expression(0, 0), myValue(value) {}
86
 
    uInt16 evaluate() { return myValue; }
 
94
    uInt16 evaluate() const
 
95
      { return myValue; }
87
96
 
88
97
  private:
89
98
    int myValue;
94
103
{
95
104
  public:
96
105
    CpuMethodExpression(CPUDEBUG_INT_METHOD method) : Expression(0, 0), myMethod(method) {}
97
 
    uInt16 evaluate() { return CALL_CPUDEBUG_METHOD(myMethod); }
 
106
    uInt16 evaluate() const
 
107
      { return CALL_CPUDEBUG_METHOD(myMethod); }
98
108
 
99
109
  private:
100
110
    CPUDEBUG_INT_METHOD myMethod;
105
115
{
106
116
  public:
107
117
    DivExpression(Expression* left, Expression* right) : Expression(left, right) {}
108
 
    uInt16 evaluate() { int denom = myRHS->evaluate();
109
 
                        return denom == 0 ? 0 : myLHS->evaluate() / denom;
110
 
                      }
 
118
    uInt16 evaluate() const
 
119
      { int denom = myRHS->evaluate();
 
120
        return denom == 0 ? 0 : myLHS->evaluate() / denom; }
111
121
};
112
122
 
113
123
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
115
125
{
116
126
  public:
117
127
    EqualsExpression(Expression* left, Expression* right) : Expression(left, right) {}
118
 
    uInt16 evaluate() { return myLHS->evaluate() == myRHS->evaluate(); }
 
128
    uInt16 evaluate() const
 
129
      { return myLHS->evaluate() == myRHS->evaluate(); }
119
130
};
120
131
 
121
132
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
123
134
{
124
135
  public:
125
136
    EquateExpression(const string& label) : Expression(0, 0), myLabel(label) {}
126
 
    uInt16 evaluate() { return Debugger::debugger().equates().getAddress(myLabel); }
 
137
    uInt16 evaluate() const
 
138
      { return Debugger::debugger().cartDebug().getAddress(myLabel); }
127
139
 
128
140
  private:
129
141
    string myLabel;
134
146
{
135
147
  public:
136
148
    FunctionExpression(const string& label) : Expression(0, 0), myLabel(label) {}
137
 
    uInt16 evaluate() {
138
 
        Expression* exp = Debugger::debugger().getFunction(myLabel);
139
 
        if(exp) return exp->evaluate();
140
 
        else return 0;
 
149
    uInt16 evaluate() const
 
150
    {
 
151
      const Expression* exp = Debugger::debugger().getFunction(myLabel);
 
152
      if(exp) return exp->evaluate();
 
153
      else    return 0;
141
154
    }
142
155
 
143
156
  private:
149
162
{
150
163
  public:
151
164
    GreaterEqualsExpression(Expression* left, Expression* right) : Expression(left, right) {}
152
 
    uInt16 evaluate() { return myLHS->evaluate() >= myRHS->evaluate(); }
 
165
    uInt16 evaluate() const
 
166
      { return myLHS->evaluate() >= myRHS->evaluate(); }
153
167
};
154
168
 
155
169
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
157
171
{
158
172
  public:
159
173
    GreaterExpression(Expression* left, Expression* right) : Expression(left, right) {}
160
 
    uInt16 evaluate() { return myLHS->evaluate() > myRHS->evaluate(); }
 
174
    uInt16 evaluate() const
 
175
      { return myLHS->evaluate() > myRHS->evaluate(); }
161
176
};
162
177
 
163
178
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
165
180
{
166
181
  public:
167
182
    HiByteExpression(Expression* left) : Expression(left, 0) {}
168
 
    uInt16 evaluate() { return 0xff & (myLHS->evaluate() >> 8); }
 
183
    uInt16 evaluate() const
 
184
      { return 0xff & (myLHS->evaluate() >> 8); }
169
185
};
170
186
 
171
187
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
173
189
{
174
190
  public:
175
191
    LessEqualsExpression(Expression* left, Expression* right) : Expression(left, right) {}
176
 
    uInt16 evaluate() { return myLHS->evaluate() <= myRHS->evaluate(); }
 
192
    uInt16 evaluate() const
 
193
      { return myLHS->evaluate() <= myRHS->evaluate(); }
177
194
};
178
195
 
179
196
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
181
198
{
182
199
  public:
183
200
    LessExpression(Expression* left, Expression* right) : Expression(left, right) {}
184
 
    uInt16 evaluate() { return myLHS->evaluate() < myRHS->evaluate(); }
 
201
    uInt16 evaluate() const
 
202
      { return myLHS->evaluate() < myRHS->evaluate(); }
185
203
};
186
204
 
187
205
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
189
207
{
190
208
  public:
191
209
    LoByteExpression(Expression* left) : Expression(left, 0) {}
192
 
    uInt16 evaluate() { return 0xff & myLHS->evaluate(); }
 
210
    uInt16 evaluate() const
 
211
      { return 0xff & myLHS->evaluate(); }
193
212
};
194
213
 
195
214
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
197
216
{
198
217
  public:
199
218
    LogAndExpression(Expression* left, Expression* right) : Expression(left, right) {}
200
 
    uInt16 evaluate() { return myLHS->evaluate() && myRHS->evaluate(); }
 
219
    uInt16 evaluate() const
 
220
      { return myLHS->evaluate() && myRHS->evaluate(); }
201
221
};
202
222
 
203
223
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
205
225
{
206
226
  public:
207
227
    LogNotExpression(Expression* left) : Expression(left, 0) {}
208
 
    uInt16 evaluate() { return !(myLHS->evaluate()); }
 
228
    uInt16 evaluate() const
 
229
      { return !(myLHS->evaluate()); }
209
230
};
210
231
 
211
232
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
213
234
{
214
235
  public:
215
236
    LogOrExpression(Expression* left, Expression* right) : Expression(left, right) {}
216
 
    uInt16 evaluate() { return myLHS->evaluate() || myRHS->evaluate(); }
 
237
    uInt16 evaluate() const
 
238
      { return myLHS->evaluate() || myRHS->evaluate(); }
217
239
};
218
240
 
219
241
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
221
243
{
222
244
  public:
223
245
    MinusExpression(Expression* left, Expression* right) : Expression(left, right) {}
224
 
    uInt16 evaluate() { return myLHS->evaluate() - myRHS->evaluate(); }
 
246
    uInt16 evaluate() const
 
247
      { return myLHS->evaluate() - myRHS->evaluate(); }
225
248
};
226
249
 
227
250
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
229
252
{
230
253
  public:
231
254
    ModExpression(Expression* left, Expression* right) : Expression(left, right) {}
232
 
    uInt16 evaluate() { int rhs = myRHS->evaluate();
233
 
                        return rhs == 0 ? 0 : myLHS->evaluate() % rhs;
234
 
                      }
 
255
    uInt16 evaluate() const
 
256
      { int rhs = myRHS->evaluate();
 
257
        return rhs == 0 ? 0 : myLHS->evaluate() % rhs; }
235
258
};
236
259
 
237
260
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
239
262
{
240
263
  public:
241
264
    MultExpression(Expression* left, Expression* right) : Expression(left, right) {}
242
 
    uInt16 evaluate() { return myLHS->evaluate() * myRHS->evaluate(); }
 
265
    uInt16 evaluate() const
 
266
      { return myLHS->evaluate() * myRHS->evaluate(); }
243
267
};
244
268
 
245
269
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
247
271
{
248
272
  public:
249
273
    NotEqualsExpression(Expression* left, Expression* right) : Expression(left, right) {}
250
 
    uInt16 evaluate() { return myLHS->evaluate() != myRHS->evaluate(); }
 
274
    uInt16 evaluate() const
 
275
      { return myLHS->evaluate() != myRHS->evaluate(); }
251
276
};
252
277
 
253
278
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
255
280
{
256
281
  public:
257
282
    PlusExpression(Expression* left, Expression* right) : Expression(left, right) {}
258
 
    uInt16 evaluate() { return myLHS->evaluate() + myRHS->evaluate(); }
 
283
    uInt16 evaluate() const
 
284
      { return myLHS->evaluate() + myRHS->evaluate(); }
 
285
};
 
286
 
 
287
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
288
class CartMethodExpression : public Expression
 
289
{
 
290
  public:
 
291
    CartMethodExpression(CARTDEBUG_INT_METHOD method) : Expression(0, 0), myMethod(method) {}
 
292
    uInt16 evaluate() const
 
293
      { return CALL_CARTDEBUG_METHOD(myMethod); }
 
294
 
 
295
  private:
 
296
    CARTDEBUG_INT_METHOD myMethod;
259
297
};
260
298
 
261
299
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
263
301
{
264
302
  public:
265
303
    ShiftLeftExpression(Expression* left, Expression* right) : Expression(left, right) {}
266
 
    uInt16 evaluate() { return myLHS->evaluate() << myRHS->evaluate(); }
 
304
    uInt16 evaluate() const
 
305
      { return myLHS->evaluate() << myRHS->evaluate(); }
267
306
};
268
307
 
269
308
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
271
310
{
272
311
  public:
273
312
    ShiftRightExpression(Expression* left, Expression* right) : Expression(left, right) {}
274
 
    uInt16 evaluate() { return myLHS->evaluate() >> myRHS->evaluate(); }
 
313
    uInt16 evaluate() const
 
314
      { return myLHS->evaluate() >> myRHS->evaluate(); }
275
315
};
276
316
 
277
317
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
279
319
{
280
320
  public:
281
321
    TiaMethodExpression(TIADEBUG_INT_METHOD method) : Expression(0, 0), myMethod(method) {}
282
 
    uInt16 evaluate() { return CALL_TIADEBUG_METHOD(myMethod); }
 
322
    uInt16 evaluate() const
 
323
      { return CALL_TIADEBUG_METHOD(myMethod); }
283
324
 
284
325
  private:
285
326
    TIADEBUG_INT_METHOD myMethod;
290
331
{
291
332
  public:
292
333
    UnaryMinusExpression(Expression* left) : Expression(left, 0) {}
293
 
    uInt16 evaluate() { return -(myLHS->evaluate()); }
 
334
    uInt16 evaluate() const
 
335
      { return -(myLHS->evaluate()); }
294
336
};
295
337
 
296
338
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
298
340
{
299
341
  public:
300
342
    WordDerefExpression(Expression* left) : Expression(left, 0) {}
301
 
    uInt16 evaluate() { return Debugger::debugger().dpeek(myLHS->evaluate()); }
 
343
    uInt16 evaluate() const
 
344
      { return Debugger::debugger().dpeek(myLHS->evaluate()); }
302
345
};
303
346
 
304
347
#endif