mirror of https://github.com/stella-emu/stella.git
Was going to have a WordMethodExpression, to match ByteMethodExpression,
but decided we'd be better off with just one IntMethodExpression class. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@652 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
09dd155287
commit
31e17b4627
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: CpuDebug.hxx,v 1.3 2005-07-15 02:19:07 urchlay Exp $
|
// $Id: CpuDebug.hxx,v 1.4 2005-07-15 02:30:47 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef CPU_DEBUG_HXX
|
#ifndef CPU_DEBUG_HXX
|
||||||
|
@ -26,8 +26,7 @@ class EquateList;
|
||||||
#include "DebuggerSystem.hxx"
|
#include "DebuggerSystem.hxx"
|
||||||
|
|
||||||
// pointer types for CpuDebug instance methods
|
// pointer types for CpuDebug instance methods
|
||||||
typedef uInt8 (CpuDebug::*CPUDEBUG_BYTE_METHOD)();
|
typedef int (CpuDebug::*CPUDEBUG_INT_METHOD)();
|
||||||
typedef uInt16 (CpuDebug::*CPUDEBUG_WORD_METHOD)();
|
|
||||||
|
|
||||||
// call the pointed-to method on the (global) CPU debugger object.
|
// call the pointed-to method on the (global) CPU debugger object.
|
||||||
#define CALL_CPUDEBUG_METHOD(method) ( ( Debugger::debugger().cpuDebug().*method)() )
|
#define CALL_CPUDEBUG_METHOD(method) ( ( Debugger::debugger().cpuDebug().*method)() )
|
||||||
|
@ -53,7 +52,9 @@ class CpuDebug : public DebuggerSystem
|
||||||
int dPeek(int address);
|
int dPeek(int address);
|
||||||
|
|
||||||
int pc() { return mySystem->m6502().PC; }
|
int pc() { return mySystem->m6502().PC; }
|
||||||
uInt8 a() { return mySystem->m6502().A; }
|
int a() { return mySystem->m6502().A; }
|
||||||
|
int x() { return mySystem->m6502().X; }
|
||||||
|
int y() { return mySystem->m6502().Y; }
|
||||||
|
|
||||||
void setPC(int pc);
|
void setPC(int pc);
|
||||||
void setSP(int sp);
|
void setSP(int sp);
|
||||||
|
|
|
@ -13,14 +13,14 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: ByteMethodExpression.cxx,v 1.1 2005-07-15 02:19:07 urchlay Exp $
|
// $Id: IntMethodExpression.cxx,v 1.1 2005-07-15 02:30:47 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "Expression.hxx"
|
#include "Expression.hxx"
|
||||||
#include "ByteMethodExpression.hxx"
|
#include "IntMethodExpression.hxx"
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
ByteMethodExpression::ByteMethodExpression(CPUDEBUG_BYTE_METHOD method)
|
IntMethodExpression::IntMethodExpression(CPUDEBUG_INT_METHOD method)
|
||||||
: Expression(0, 0)
|
: Expression(0, 0)
|
||||||
{
|
{
|
||||||
myMethod = method;
|
myMethod = method;
|
|
@ -13,11 +13,11 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: ByteMethodExpression.hxx,v 1.1 2005-07-15 02:19:07 urchlay Exp $
|
// $Id: IntMethodExpression.hxx,v 1.1 2005-07-15 02:30:47 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef BYTEMETHOD_EXPRESSION_HXX
|
#ifndef INTMETHOD_EXPRESSION_HXX
|
||||||
#define BYTEMETHOD_EXPRESSION_HXX
|
#define INTMETHOD_EXPRESSION_HXX
|
||||||
|
|
||||||
#include "Debugger.hxx"
|
#include "Debugger.hxx"
|
||||||
#include "CpuDebug.hxx"
|
#include "CpuDebug.hxx"
|
||||||
|
@ -25,16 +25,16 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@author B. Watson
|
@author B. Watson
|
||||||
@version $Id: ByteMethodExpression.hxx,v 1.1 2005-07-15 02:19:07 urchlay Exp $
|
@version $Id: IntMethodExpression.hxx,v 1.1 2005-07-15 02:30:47 urchlay Exp $
|
||||||
*/
|
*/
|
||||||
class ByteMethodExpression : public Expression
|
class IntMethodExpression : public Expression
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ByteMethodExpression(CPUDEBUG_BYTE_METHOD method);
|
IntMethodExpression(CPUDEBUG_INT_METHOD method);
|
||||||
int evaluate() { return CALL_CPUDEBUG_METHOD(myMethod); }
|
int evaluate() { return CALL_CPUDEBUG_METHOD(myMethod); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CPUDEBUG_BYTE_METHOD myMethod;
|
CPUDEBUG_INT_METHOD myMethod;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -5,7 +5,7 @@ MODULE_OBJS := \
|
||||||
src/debugger/DebuggerParser.o \
|
src/debugger/DebuggerParser.o \
|
||||||
src/debugger/EquateList.o \
|
src/debugger/EquateList.o \
|
||||||
src/debugger/Expression.o \
|
src/debugger/Expression.o \
|
||||||
src/debugger/ByteMethodExpression.o \
|
src/debugger/IntMethodExpression.o \
|
||||||
src/debugger/ByteDerefExpression.o \
|
src/debugger/ByteDerefExpression.o \
|
||||||
src/debugger/WordDerefExpression.o \
|
src/debugger/WordDerefExpression.o \
|
||||||
src/debugger/ConstExpression.o \
|
src/debugger/ConstExpression.o \
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: YaccParser.cxx,v 1.8 2005-07-15 02:19:07 urchlay Exp $
|
// $Id: YaccParser.cxx,v 1.9 2005-07-15 02:30:47 urchlay Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
#include "BinNotExpression.hxx"
|
#include "BinNotExpression.hxx"
|
||||||
#include "BinOrExpression.hxx"
|
#include "BinOrExpression.hxx"
|
||||||
#include "BinXorExpression.hxx"
|
#include "BinXorExpression.hxx"
|
||||||
#include "ByteMethodExpression.hxx"
|
#include "IntMethodExpression.hxx"
|
||||||
#include "ByteDerefExpression.hxx"
|
#include "ByteDerefExpression.hxx"
|
||||||
#include "WordDerefExpression.hxx"
|
#include "WordDerefExpression.hxx"
|
||||||
#include "ConstExpression.hxx"
|
#include "ConstExpression.hxx"
|
||||||
|
@ -174,7 +174,7 @@ int const_to_int(char *c) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CPUDEBUG_BYTE_METHOD getByteSpecial(char *c) {
|
CPUDEBUG_INT_METHOD getSpecial(char *c) {
|
||||||
if(strcmp(c, "a") == 0)
|
if(strcmp(c, "a") == 0)
|
||||||
return &CpuDebug::a;
|
return &CpuDebug::a;
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ int yylex() {
|
||||||
|
|
||||||
case ST_IDENTIFIER:
|
case ST_IDENTIFIER:
|
||||||
{
|
{
|
||||||
CPUDEBUG_BYTE_METHOD meth;
|
CPUDEBUG_INT_METHOD meth;
|
||||||
|
|
||||||
char *bufp = idbuf;
|
char *bufp = idbuf;
|
||||||
*bufp++ = *c++; // might be a base prefix
|
*bufp++ = *c++; // might be a base prefix
|
||||||
|
@ -218,9 +218,9 @@ int yylex() {
|
||||||
if(Debugger::debugger().equates()->getAddress(idbuf) > -1) {
|
if(Debugger::debugger().equates()->getAddress(idbuf) > -1) {
|
||||||
yylval.equate = idbuf;
|
yylval.equate = idbuf;
|
||||||
return EQUATE;
|
return EQUATE;
|
||||||
} else if( (meth = getByteSpecial(idbuf)) ) {
|
} else if( (meth = getSpecial(idbuf)) ) {
|
||||||
yylval.byteMethod = meth;
|
yylval.intMethod = meth;
|
||||||
return BYTE_METHOD;
|
return INT_METHOD;
|
||||||
} else {
|
} else {
|
||||||
yylval.val = const_to_int(idbuf);
|
yylval.val = const_to_int(idbuf);
|
||||||
return NUMBER;
|
return NUMBER;
|
||||||
|
|
|
@ -16,14 +16,14 @@ void yyerror(char *e) {
|
||||||
%union {
|
%union {
|
||||||
int val;
|
int val;
|
||||||
char *equate;
|
char *equate;
|
||||||
CPUDEBUG_BYTE_METHOD byteMethod;
|
CPUDEBUG_INT_METHOD intMethod;
|
||||||
Expression *exp;
|
Expression *exp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Terminals */
|
/* Terminals */
|
||||||
%token <val> NUMBER
|
%token <val> NUMBER
|
||||||
%token <equate> EQUATE
|
%token <equate> EQUATE
|
||||||
%token <byteMethod> BYTE_METHOD
|
%token <intMethod> INT_METHOD
|
||||||
|
|
||||||
/* Non-terminals */
|
/* Non-terminals */
|
||||||
%type <exp> expression
|
%type <exp> expression
|
||||||
|
@ -74,6 +74,6 @@ expression: expression '+' expression { fprintf(stderr, " +"); $$ = new PlusExpr
|
||||||
| '(' expression ')' { fprintf(stderr, " ()"); $$ = $2; }
|
| '(' expression ')' { fprintf(stderr, " ()"); $$ = $2; }
|
||||||
| NUMBER { fprintf(stderr, " %d", $1); $$ = new ConstExpression($1); }
|
| NUMBER { fprintf(stderr, " %d", $1); $$ = new ConstExpression($1); }
|
||||||
| EQUATE { fprintf(stderr, " %s", $1); $$ = new EquateExpression($1); }
|
| EQUATE { fprintf(stderr, " %s", $1); $$ = new EquateExpression($1); }
|
||||||
| BYTE_METHOD { fprintf(stderr, " (byteMeth)"); $$ = new ByteMethodExpression($1); }
|
| INT_METHOD { fprintf(stderr, " (intMethod)"); $$ = new IntMethodExpression($1); }
|
||||||
;
|
;
|
||||||
%%
|
%%
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
# define NUMBER 257
|
# define NUMBER 257
|
||||||
# define EQUATE 258
|
# define EQUATE 258
|
||||||
# define BYTE_METHOD 259
|
# define INT_METHOD 259
|
||||||
# define LOG_OR 260
|
# define LOG_OR 260
|
||||||
# define LOG_AND 261
|
# define LOG_AND 261
|
||||||
# define LOG_NOT 262
|
# define LOG_NOT 262
|
||||||
|
@ -38,7 +38,7 @@ void yyerror(char *e) {
|
||||||
typedef union {
|
typedef union {
|
||||||
int val;
|
int val;
|
||||||
char *equate;
|
char *equate;
|
||||||
CPUDEBUG_BYTE_METHOD byteMethod;
|
CPUDEBUG_INT_METHOD intMethod;
|
||||||
Expression *exp;
|
Expression *exp;
|
||||||
} yystype;
|
} yystype;
|
||||||
# define YYSTYPE yystype
|
# define YYSTYPE yystype
|
||||||
|
@ -132,7 +132,7 @@ static const short yyrline[] =
|
||||||
/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
|
/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
|
||||||
static const char *const yytname[] =
|
static const char *const yytname[] =
|
||||||
{
|
{
|
||||||
"$", "error", "$undefined.", "NUMBER", "EQUATE", "BYTE_METHOD", "'-'",
|
"$", "error", "$undefined.", "NUMBER", "EQUATE", "INT_METHOD", "'-'",
|
||||||
"'+'", "'*'", "'/'", "'%'", "LOG_OR", "LOG_AND", "LOG_NOT", "'|'",
|
"'+'", "'*'", "'/'", "'%'", "LOG_OR", "LOG_AND", "LOG_NOT", "'|'",
|
||||||
"'^'", "'&'", "SHR", "SHL", "'<'", "'>'", "GTE", "LTE", "NE", "EQ",
|
"'^'", "'&'", "SHR", "SHL", "'<'", "'>'", "GTE", "LTE", "NE", "EQ",
|
||||||
"DEREF", "UMINUS", "'~'", "'!'", "'@'", "'('", "')'", "statement",
|
"DEREF", "UMINUS", "'~'", "'!'", "'@'", "'('", "')'", "statement",
|
||||||
|
@ -1063,7 +1063,7 @@ case 29:
|
||||||
break;
|
break;
|
||||||
case 30:
|
case 30:
|
||||||
#line 77 "stella.y"
|
#line 77 "stella.y"
|
||||||
{ fprintf(stderr, " (byteMeth)"); yyval.exp = new ByteMethodExpression(yyvsp[0].byteMethod); }
|
{ fprintf(stderr, " (intMethod)"); yyval.exp = new IntMethodExpression(yyvsp[0].intMethod); }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
typedef union {
|
typedef union {
|
||||||
int val;
|
int val;
|
||||||
char *equate;
|
char *equate;
|
||||||
CPUDEBUG_BYTE_METHOD byteMethod;
|
CPUDEBUG_INT_METHOD intMethod;
|
||||||
Expression *exp;
|
Expression *exp;
|
||||||
} yystype;
|
} yystype;
|
||||||
# define YYSTYPE yystype
|
# define YYSTYPE yystype
|
||||||
|
@ -13,7 +13,7 @@ typedef union {
|
||||||
#endif
|
#endif
|
||||||
# define NUMBER 257
|
# define NUMBER 257
|
||||||
# define EQUATE 258
|
# define EQUATE 258
|
||||||
# define BYTE_METHOD 259
|
# define INT_METHOD 259
|
||||||
# define LOG_OR 260
|
# define LOG_OR 260
|
||||||
# define LOG_AND 261
|
# define LOG_AND 261
|
||||||
# define LOG_NOT 262
|
# define LOG_NOT 262
|
||||||
|
|
Loading…
Reference in New Issue