Method pointer expressions. "expr a" gives current accumulator value. Try

it, then try changing the A register, then "expr". It should return the
changed value.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@651 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
urchlay 2005-07-15 02:19:07 +00:00
parent 1c7cb335d6
commit 09dd155287
9 changed files with 259 additions and 137 deletions

View File

@ -0,0 +1,28 @@
//============================================================================
//
// 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-2005 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: ByteMethodExpression.cxx,v 1.1 2005-07-15 02:19:07 urchlay Exp $
//============================================================================
#include "Expression.hxx"
#include "ByteMethodExpression.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteMethodExpression::ByteMethodExpression(CPUDEBUG_BYTE_METHOD method)
: Expression(0, 0)
{
myMethod = method;
}

View File

@ -0,0 +1,41 @@
//============================================================================
//
// 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-2005 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: ByteMethodExpression.hxx,v 1.1 2005-07-15 02:19:07 urchlay Exp $
//============================================================================
#ifndef BYTEMETHOD_EXPRESSION_HXX
#define BYTEMETHOD_EXPRESSION_HXX
#include "Debugger.hxx"
#include "CpuDebug.hxx"
#include "Expression.hxx"
/**
@author B. Watson
@version $Id: ByteMethodExpression.hxx,v 1.1 2005-07-15 02:19:07 urchlay Exp $
*/
class ByteMethodExpression : public Expression
{
public:
ByteMethodExpression(CPUDEBUG_BYTE_METHOD method);
int evaluate() { return CALL_CPUDEBUG_METHOD(myMethod); }
private:
CPUDEBUG_BYTE_METHOD myMethod;
};
#endif

View File

@ -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.2 2005-07-08 14:36:17 stephena Exp $ // $Id: CpuDebug.hxx,v 1.3 2005-07-15 02:19:07 urchlay Exp $
//============================================================================ //============================================================================
#ifndef CPU_DEBUG_HXX #ifndef CPU_DEBUG_HXX
@ -25,6 +25,13 @@ class EquateList;
#include "System.hxx" #include "System.hxx"
#include "DebuggerSystem.hxx" #include "DebuggerSystem.hxx"
// pointer types for CpuDebug instance methods
typedef uInt8 (CpuDebug::*CPUDEBUG_BYTE_METHOD)();
typedef uInt16 (CpuDebug::*CPUDEBUG_WORD_METHOD)();
// call the pointed-to method on the (global) CPU debugger object.
#define CALL_CPUDEBUG_METHOD(method) ( ( Debugger::debugger().cpuDebug().*method)() )
class CpuState : public DebuggerState class CpuState : public DebuggerState
{ {
public: public:
@ -46,6 +53,7 @@ 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; }
void setPC(int pc); void setPC(int pc);
void setSP(int sp); void setSP(int sp);

View File

@ -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: Debugger.hxx,v 1.52 2005-07-15 01:20:11 urchlay Exp $ // $Id: Debugger.hxx,v 1.53 2005-07-15 02:19:07 urchlay Exp $
//============================================================================ //============================================================================
#ifndef DEBUGGER_HXX #ifndef DEBUGGER_HXX
@ -47,12 +47,23 @@ enum {
kRamSize = 128 kRamSize = 128
}; };
/*
// These will probably turn out to be unneeded, left for reference for now
// pointer types for Debugger instance methods
typedef uInt8 (Debugger::*DEBUGGER_BYTE_METHOD)();
typedef uInt16 (Debugger::*DEBUGGER_WORD_METHOD)();
// call the pointed-to method on the (static) debugger object.
#define CALL_DEBUGGER_METHOD(method) ( ( Debugger::debugger().*method)() )
*/
/** /**
The base dialog for all debugging widgets in Stella. Also acts as the parent The base dialog for all debugging widgets in Stella. Also acts as the parent
for all debugging operations in Stella (parser, 6502 debugger, etc). for all debugging operations in Stella (parser, 6502 debugger, etc).
@author Stephen Anthony @author Stephen Anthony
@version $Id: Debugger.hxx,v 1.52 2005-07-15 01:20:11 urchlay Exp $ @version $Id: Debugger.hxx,v 1.53 2005-07-15 02:19:07 urchlay Exp $
*/ */
class Debugger : public DialogContainer class Debugger : public DialogContainer
{ {

View File

@ -5,6 +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/ByteDerefExpression.o \ src/debugger/ByteDerefExpression.o \
src/debugger/WordDerefExpression.o \ src/debugger/WordDerefExpression.o \
src/debugger/ConstExpression.o \ src/debugger/ConstExpression.o \

View File

@ -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.7 2005-07-15 01:40:34 urchlay Exp $ // $Id: YaccParser.cxx,v 1.8 2005-07-15 02:19:07 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
@ -26,11 +26,13 @@
//#endif //#endif
#include "Expression.hxx" #include "Expression.hxx"
#include "CpuDebug.hxx"
#include "BinAndExpression.hxx" #include "BinAndExpression.hxx"
#include "BinNotExpression.hxx" #include "BinNotExpression.hxx"
#include "BinOrExpression.hxx" #include "BinOrExpression.hxx"
#include "BinXorExpression.hxx" #include "BinXorExpression.hxx"
#include "ByteMethodExpression.hxx"
#include "ByteDerefExpression.hxx" #include "ByteDerefExpression.hxx"
#include "WordDerefExpression.hxx" #include "WordDerefExpression.hxx"
#include "ConstExpression.hxx" #include "ConstExpression.hxx"
@ -172,6 +174,13 @@ int const_to_int(char *c) {
} }
} }
CPUDEBUG_BYTE_METHOD getByteSpecial(char *c) {
if(strcmp(c, "a") == 0)
return &CpuDebug::a;
return 0;
}
int yylex() { int yylex() {
static char idbuf[255]; static char idbuf[255];
char o, p; char o, p;
@ -195,6 +204,8 @@ int yylex() {
case ST_IDENTIFIER: case ST_IDENTIFIER:
{ {
CPUDEBUG_BYTE_METHOD meth;
char *bufp = idbuf; char *bufp = idbuf;
*bufp++ = *c++; // might be a base prefix *bufp++ = *c++; // might be a base prefix
while(is_identifier(*c)) { // may NOT be base prefixes while(is_identifier(*c)) { // may NOT be base prefixes
@ -207,6 +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)) ) {
yylval.byteMethod = meth;
return BYTE_METHOD;
} else { } else {
yylval.val = const_to_int(idbuf); yylval.val = const_to_int(idbuf);
return NUMBER; return NUMBER;

View File

@ -16,12 +16,14 @@ void yyerror(char *e) {
%union { %union {
int val; int val;
char *equate; char *equate;
CPUDEBUG_BYTE_METHOD byteMethod;
Expression *exp; Expression *exp;
} }
/* Terminals */ /* Terminals */
%token <val> NUMBER %token <val> NUMBER
%token <equate> EQUATE %token <equate> EQUATE
%token <byteMethod> BYTE_METHOD
/* Non-terminals */ /* Non-terminals */
%type <exp> expression %type <exp> expression
@ -72,5 +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); }
; ;
%% %%

View File

@ -5,17 +5,18 @@
# define NUMBER 257 # define NUMBER 257
# define EQUATE 258 # define EQUATE 258
# define LOG_OR 259 # define BYTE_METHOD 259
# define LOG_AND 260 # define LOG_OR 260
# define LOG_NOT 261 # define LOG_AND 261
# define SHR 262 # define LOG_NOT 262
# define SHL 263 # define SHR 263
# define GTE 264 # define SHL 264
# define LTE 265 # define GTE 265
# define NE 266 # define LTE 266
# define EQ 267 # define NE 267
# define DEREF 268 # define EQ 268
# define UMINUS 269 # define DEREF 269
# define UMINUS 270
#line 1 "stella.y" #line 1 "stella.y"
@ -37,6 +38,7 @@ void yyerror(char *e) {
typedef union { typedef union {
int val; int val;
char *equate; char *equate;
CPUDEBUG_BYTE_METHOD byteMethod;
Expression *exp; Expression *exp;
} yystype; } yystype;
# define YYSTYPE yystype # define YYSTYPE yystype
@ -48,12 +50,12 @@ typedef union {
#define YYFINAL 59 #define YYFINAL 60
#define YYFLAG -32768 #define YYFLAG -32768
#define YYNTBASE 31 #define YYNTBASE 32
/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
#define YYTRANSLATE(x) ((unsigned)(x) <= 269 ? yytranslate[x] : 33) #define YYTRANSLATE(x) ((unsigned)(x) <= 270 ? yytranslate[x] : 34)
/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
static const char yytranslate[] = static const char yytranslate[] =
@ -61,16 +63,16 @@ static const char yytranslate[] =
0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 27, 2, 2, 2, 9, 15, 2, 2, 2, 2, 28, 2, 2, 2, 10, 16, 2,
29, 30, 7, 6, 2, 5, 2, 8, 2, 2, 30, 31, 8, 7, 2, 6, 2, 9, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
18, 2, 19, 2, 28, 2, 2, 2, 2, 2, 19, 2, 20, 2, 29, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 14, 2, 2, 2, 2, 2, 2, 2, 2, 2, 15, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 13, 2, 26, 2, 2, 2, 2, 2, 2, 2, 14, 2, 27, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@ -83,8 +85,9 @@ static const char yytranslate[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 3, 4, 10, 2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
11, 12, 16, 17, 20, 21, 22, 23, 24, 25 11, 12, 13, 17, 18, 21, 22, 23, 24, 25,
26
}; };
#if YYDEBUG #if YYDEBUG
@ -92,21 +95,22 @@ static const short yyprhs[] =
{ {
0, 0, 2, 6, 10, 14, 18, 22, 26, 30, 0, 0, 2, 6, 10, 14, 18, 22, 26, 30,
34, 38, 42, 46, 50, 54, 58, 62, 66, 70, 34, 38, 42, 46, 50, 54, 58, 62, 66, 70,
74, 77, 80, 83, 86, 89, 92, 95, 99, 101 74, 77, 80, 83, 86, 89, 92, 95, 99, 101,
103
}; };
static const short yyrhs[] = static const short yyrhs[] =
{ {
32, 0, 32, 6, 32, 0, 32, 5, 32, 0, 33, 0, 33, 7, 33, 0, 33, 6, 33, 0,
32, 7, 32, 0, 32, 8, 32, 0, 32, 9, 33, 8, 33, 0, 33, 9, 33, 0, 33, 10,
32, 0, 32, 15, 32, 0, 32, 13, 32, 0, 33, 0, 33, 16, 33, 0, 33, 14, 33, 0,
32, 14, 32, 0, 32, 18, 32, 0, 32, 19, 33, 15, 33, 0, 33, 19, 33, 0, 33, 20,
32, 0, 32, 20, 32, 0, 32, 21, 32, 0, 33, 0, 33, 21, 33, 0, 33, 22, 33, 0,
32, 22, 32, 0, 32, 23, 32, 0, 32, 16, 33, 23, 33, 0, 33, 24, 33, 0, 33, 17,
32, 0, 32, 17, 32, 0, 32, 10, 32, 0, 33, 0, 33, 18, 33, 0, 33, 11, 33, 0,
32, 11, 32, 0, 5, 32, 0, 26, 32, 0, 33, 12, 33, 0, 6, 33, 0, 27, 33, 0,
27, 32, 0, 7, 32, 0, 28, 32, 0, 18, 28, 33, 0, 8, 33, 0, 29, 33, 0, 19,
32, 0, 19, 32, 0, 29, 32, 30, 0, 3, 33, 0, 20, 33, 0, 30, 33, 31, 0, 3,
0, 4, 0 0, 4, 0, 5, 0
}; };
#endif #endif
@ -115,9 +119,10 @@ static const short yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const short yyrline[] = static const short yyrline[] =
{ {
0, 44, 47, 48, 49, 50, 51, 52, 53, 54, 0, 46, 49, 50, 51, 52, 53, 54, 55, 56,
55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
65, 66, 67, 68, 69, 70, 71, 72, 73, 74 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
77
}; };
#endif #endif
@ -127,19 +132,21 @@ 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", "'-'", "'+'", "'*'", "$", "error", "$undefined.", "NUMBER", "EQUATE", "BYTE_METHOD", "'-'",
"'/'", "'%'", "LOG_OR", "LOG_AND", "LOG_NOT", "'|'", "'^'", "'&'", "'+'", "'*'", "'/'", "'%'", "LOG_OR", "LOG_AND", "LOG_NOT", "'|'",
"SHR", "SHL", "'<'", "'>'", "GTE", "LTE", "NE", "EQ", "DEREF", "UMINUS", "'^'", "'&'", "SHR", "SHL", "'<'", "'>'", "GTE", "LTE", "NE", "EQ",
"'~'", "'!'", "'@'", "'('", "')'", "statement", "expression", 0 "DEREF", "UMINUS", "'~'", "'!'", "'@'", "'('", "')'", "statement",
"expression", 0
}; };
#endif #endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const short yyr1[] = static const short yyr1[] =
{ {
0, 31, 32, 32, 32, 32, 32, 32, 32, 32, 0, 32, 33, 33, 33, 33, 33, 33, 33, 33,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
33
}; };
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@ -147,7 +154,8 @@ static const short yyr2[] =
{ {
0, 1, 3, 3, 3, 3, 3, 3, 3, 3, 0, 1, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
2, 2, 2, 2, 2, 2, 2, 3, 1, 1 2, 2, 2, 2, 2, 2, 2, 3, 1, 1,
1
}; };
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
@ -155,78 +163,80 @@ static const short yyr2[] =
error. */ error. */
static const short yydefact[] = static const short yydefact[] =
{ {
0, 28, 29, 0, 0, 0, 0, 0, 0, 0, 0, 28, 29, 30, 0, 0, 0, 0, 0, 0,
0, 1, 20, 23, 25, 26, 21, 22, 24, 0, 0, 0, 1, 20, 23, 25, 26, 21, 22, 24,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 27, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27,
2, 4, 5, 6, 18, 19, 8, 9, 7, 16, 3, 2, 4, 5, 6, 18, 19, 8, 9, 7,
17, 10, 11, 12, 13, 14, 15, 0, 0, 0 16, 17, 10, 11, 12, 13, 14, 15, 0, 0,
0
}; };
static const short yydefgoto[] = static const short yydefgoto[] =
{ {
57, 11 58, 12
}; };
static const short yypact[] = static const short yypact[] =
{ {
32,-32768,-32768, 32, 32, 32, 32, 32, 32, 32, 32,-32768,-32768,-32768, 32, 32, 32, 32, 32, 32,
32, 83,-32768,-32768, 34, 34,-32768,-32768,-32768, 57, 32, 32, 83,-32768,-32768, 34, 34,-32768,-32768,-32768,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 57, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32,-32768, 100, 32, 32, 32, 32, 32, 32, 32, 32, 32,-32768,
100, 114, 114, 114, 127, 138, -7, -7, 24, 63, 100, 100, 114, 114, 114, 127, 138, -8, -8, 24,
63, 34, 34, 34, 34, 34, 34, 38, 48,-32768 63, 63, 34, 34, 34, 34, 34, 34, 39, 49,
-32768
}; };
static const short yypgoto[] = static const short yypgoto[] =
{ {
-32768, -3 -32768, -4
}; };
#define YYLAST 161 #define YYLAST 162
static const short yytable[] = static const short yytable[] =
{ {
12, 13, 14, 15, 16, 17, 18, 19, 29, 30, 13, 14, 15, 16, 17, 18, 19, 20, 30, 31,
31, 32, 33, 34, 35, 36, 37, 39, 40, 41, 32, 33, 34, 35, 36, 37, 38, 40, 41, 42,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
52, 53, 54, 55, 56, 1, 2, 3, 58, 4, 53, 54, 55, 56, 57, 1, 2, 3, 4, 59,
30, 31, 32, 33, 34, 35, 36, 37, 59, 0, 5, 31, 32, 33, 34, 35, 36, 37, 38, 60,
5, 6,-32768,-32768,-32768,-32768,-32768,-32768, 7, 8, 0, 6, 7,-32768,-32768,-32768,-32768,-32768,-32768, 8,
9, 10, 20, 21, 22, 23, 24, 25, 26, 0, 9, 10, 11, 21, 22, 23, 24, 25, 26, 27,
27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 0, 28, 29, 30, 31, 32, 33, 34, 35, 36,
37, 32, 33, 34, 35, 36, 37, 38, 20, 21, 37, 38, 33, 34, 35, 36, 37, 38, 39, 21,
22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 22, 23, 24, 25, 26, 27, 0, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 22, 23, 24, 31, 32, 33, 34, 35, 36, 37, 38, 23, 24,
25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 25, 26, 27, 0, 28, 29, 30, 31, 32, 33,
34, 35, 36, 37, 25, 26, 0, 27, 28, 29, 34, 35, 36, 37, 38, 26, 27, 0, 28, 29,
30, 31, 32, 33, 34, 35, 36, 37, 26, 0, 30, 31, 32, 33, 34, 35, 36, 37, 38, 27,
27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 0, 28, 29, 30, 31, 32, 33, 34, 35, 36,
37, 27, 28, 29, 30, 31, 32, 33, 34, 35, 37, 38, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37 36, 37, 38
}; };
static const short yycheck[] = static const short yycheck[] =
{ {
3, 4, 5, 6, 7, 8, 9, 10, 15, 16, 4, 5, 6, 7, 8, 9, 10, 11, 16, 17,
17, 18, 19, 20, 21, 22, 23, 20, 21, 22, 18, 19, 20, 21, 22, 23, 24, 21, 22, 23,
23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
33, 34, 35, 36, 37, 3, 4, 5, 0, 7, 34, 35, 36, 37, 38, 3, 4, 5, 6, 0,
16, 17, 18, 19, 20, 21, 22, 23, 0, -1, 8, 17, 18, 19, 20, 21, 22, 23, 24, 0,
18, 19, 18, 19, 20, 21, 22, 23, 26, 27, -1, 19, 20, 19, 20, 21, 22, 23, 24, 27,
28, 29, 5, 6, 7, 8, 9, 10, 11, -1, 28, 29, 30, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, 14, 15, 16, 17, 18, 19, 20, 21, 22,
23, 18, 19, 20, 21, 22, 23, 30, 5, 6, 23, 24, 19, 20, 21, 22, 23, 24, 31, 6,
7, 8, 9, 10, 11, -1, 13, 14, 15, 16, 7, 8, 9, 10, 11, 12, -1, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 7, 8, 9, 17, 18, 19, 20, 21, 22, 23, 24, 8, 9,
10, 11, -1, 13, 14, 15, 16, 17, 18, 19, 10, 11, 12, -1, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 10, 11, -1, 13, 14, 15, 20, 21, 22, 23, 24, 11, 12, -1, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 11, -1, 16, 17, 18, 19, 20, 21, 22, 23, 24, 12,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, 14, 15, 16, 17, 18, 19, 20, 21, 22,
23, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 14, 15, 16, 17, 18, 19, 20, 21,
22, 23 22, 23, 24
}; };
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "/usr/share/bison/bison.simple" #line 3 "/usr/share/bison/bison.simple"
@ -936,121 +946,125 @@ yyreduce:
switch (yyn) { switch (yyn) {
case 1: case 1:
#line 44 "stella.y" #line 46 "stella.y"
{ fprintf(stderr, "\ndone\n"); result.exp = yyvsp[0].exp; } { fprintf(stderr, "\ndone\n"); result.exp = yyvsp[0].exp; }
break; break;
case 2: case 2:
#line 47 "stella.y" #line 49 "stella.y"
{ fprintf(stderr, " +"); yyval.exp = new PlusExpression(yyvsp[-2].exp, yyvsp[0].exp); } { fprintf(stderr, " +"); yyval.exp = new PlusExpression(yyvsp[-2].exp, yyvsp[0].exp); }
break; break;
case 3: case 3:
#line 48 "stella.y" #line 50 "stella.y"
{ fprintf(stderr, " -"); yyval.exp = new MinusExpression(yyvsp[-2].exp, yyvsp[0].exp); } { fprintf(stderr, " -"); yyval.exp = new MinusExpression(yyvsp[-2].exp, yyvsp[0].exp); }
break; break;
case 4: case 4:
#line 49 "stella.y" #line 51 "stella.y"
{ fprintf(stderr, " *"); yyval.exp = new MultExpression(yyvsp[-2].exp, yyvsp[0].exp); } { fprintf(stderr, " *"); yyval.exp = new MultExpression(yyvsp[-2].exp, yyvsp[0].exp); }
break; break;
case 5: case 5:
#line 50 "stella.y" #line 52 "stella.y"
{ fprintf(stderr, " /"); yyval.exp = new DivExpression(yyvsp[-2].exp, yyvsp[0].exp); } { fprintf(stderr, " /"); yyval.exp = new DivExpression(yyvsp[-2].exp, yyvsp[0].exp); }
break; break;
case 6: case 6:
#line 51 "stella.y" #line 53 "stella.y"
{ fprintf(stderr, " %%"); yyval.exp = new ModExpression(yyvsp[-2].exp, yyvsp[0].exp); } { fprintf(stderr, " %%"); yyval.exp = new ModExpression(yyvsp[-2].exp, yyvsp[0].exp); }
break; break;
case 7: case 7:
#line 52 "stella.y" #line 54 "stella.y"
{ fprintf(stderr, " &"); yyval.exp = new BinAndExpression(yyvsp[-2].exp, yyvsp[0].exp); } { fprintf(stderr, " &"); yyval.exp = new BinAndExpression(yyvsp[-2].exp, yyvsp[0].exp); }
break; break;
case 8: case 8:
#line 53 "stella.y" #line 55 "stella.y"
{ fprintf(stderr, " |"); yyval.exp = new BinOrExpression(yyvsp[-2].exp, yyvsp[0].exp); } { fprintf(stderr, " |"); yyval.exp = new BinOrExpression(yyvsp[-2].exp, yyvsp[0].exp); }
break; break;
case 9: case 9:
#line 54 "stella.y" #line 56 "stella.y"
{ fprintf(stderr, " ^"); yyval.exp = new BinXorExpression(yyvsp[-2].exp, yyvsp[0].exp); } { fprintf(stderr, " ^"); yyval.exp = new BinXorExpression(yyvsp[-2].exp, yyvsp[0].exp); }
break; break;
case 10: case 10:
#line 55 "stella.y" #line 57 "stella.y"
{ fprintf(stderr, " <"); yyval.exp = new LessExpression(yyvsp[-2].exp, yyvsp[0].exp); } { fprintf(stderr, " <"); yyval.exp = new LessExpression(yyvsp[-2].exp, yyvsp[0].exp); }
break; break;
case 11: case 11:
#line 56 "stella.y" #line 58 "stella.y"
{ fprintf(stderr, " >"); yyval.exp = new GreaterExpression(yyvsp[-2].exp, yyvsp[0].exp); } { fprintf(stderr, " >"); yyval.exp = new GreaterExpression(yyvsp[-2].exp, yyvsp[0].exp); }
break; break;
case 12: case 12:
#line 57 "stella.y" #line 59 "stella.y"
{ fprintf(stderr, " >="); yyval.exp = new GreaterEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); } { fprintf(stderr, " >="); yyval.exp = new GreaterEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); }
break; break;
case 13: case 13:
#line 58 "stella.y" #line 60 "stella.y"
{ fprintf(stderr, " <="); yyval.exp = new LessEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); } { fprintf(stderr, " <="); yyval.exp = new LessEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); }
break; break;
case 14: case 14:
#line 59 "stella.y" #line 61 "stella.y"
{ fprintf(stderr, " !="); yyval.exp = new NotEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); } { fprintf(stderr, " !="); yyval.exp = new NotEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); }
break; break;
case 15: case 15:
#line 60 "stella.y" #line 62 "stella.y"
{ fprintf(stderr, " =="); yyval.exp = new EqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); } { fprintf(stderr, " =="); yyval.exp = new EqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); }
break; break;
case 16: case 16:
#line 61 "stella.y" #line 63 "stella.y"
{ fprintf(stderr, " >>"); yyval.exp = new ShiftRightExpression(yyvsp[-2].exp, yyvsp[0].exp); } { fprintf(stderr, " >>"); yyval.exp = new ShiftRightExpression(yyvsp[-2].exp, yyvsp[0].exp); }
break; break;
case 17: case 17:
#line 62 "stella.y" #line 64 "stella.y"
{ fprintf(stderr, " <<"); yyval.exp = new ShiftLeftExpression(yyvsp[-2].exp, yyvsp[0].exp); } { fprintf(stderr, " <<"); yyval.exp = new ShiftLeftExpression(yyvsp[-2].exp, yyvsp[0].exp); }
break; break;
case 18: case 18:
#line 63 "stella.y" #line 65 "stella.y"
{ fprintf(stderr, " ||"); yyval.exp = new LogOrExpression(yyvsp[-2].exp, yyvsp[0].exp); } { fprintf(stderr, " ||"); yyval.exp = new LogOrExpression(yyvsp[-2].exp, yyvsp[0].exp); }
break; break;
case 19: case 19:
#line 64 "stella.y" #line 66 "stella.y"
{ fprintf(stderr, " &&"); yyval.exp = new LogAndExpression(yyvsp[-2].exp, yyvsp[0].exp); } { fprintf(stderr, " &&"); yyval.exp = new LogAndExpression(yyvsp[-2].exp, yyvsp[0].exp); }
break; break;
case 20: case 20:
#line 65 "stella.y" #line 67 "stella.y"
{ fprintf(stderr, " U-"); yyval.exp = new UnaryMinusExpression(yyvsp[0].exp); } { fprintf(stderr, " U-"); yyval.exp = new UnaryMinusExpression(yyvsp[0].exp); }
break; break;
case 21: case 21:
#line 66 "stella.y" #line 68 "stella.y"
{ fprintf(stderr, " ~"); yyval.exp = new BinNotExpression(yyvsp[0].exp); } { fprintf(stderr, " ~"); yyval.exp = new BinNotExpression(yyvsp[0].exp); }
break; break;
case 22: case 22:
#line 67 "stella.y" #line 69 "stella.y"
{ fprintf(stderr, " !"); yyval.exp = new LogNotExpression(yyvsp[0].exp); } { fprintf(stderr, " !"); yyval.exp = new LogNotExpression(yyvsp[0].exp); }
break; break;
case 23: case 23:
#line 68 "stella.y" #line 70 "stella.y"
{ fprintf(stderr, " U*"); yyval.exp = new ByteDerefExpression(yyvsp[0].exp); } { fprintf(stderr, " U*"); yyval.exp = new ByteDerefExpression(yyvsp[0].exp); }
break; break;
case 24: case 24:
#line 69 "stella.y" #line 71 "stella.y"
{ fprintf(stderr, " U@"); yyval.exp = new WordDerefExpression(yyvsp[0].exp); } { fprintf(stderr, " U@"); yyval.exp = new WordDerefExpression(yyvsp[0].exp); }
break; break;
case 25: case 25:
#line 70 "stella.y" #line 72 "stella.y"
{ fprintf(stderr, " U<"); yyval.exp = new LoByteExpression(yyvsp[0].exp); } { fprintf(stderr, " U<"); yyval.exp = new LoByteExpression(yyvsp[0].exp); }
break; break;
case 26: case 26:
#line 71 "stella.y" #line 73 "stella.y"
{ fprintf(stderr, " U>"); yyval.exp = new HiByteExpression(yyvsp[0].exp); } { fprintf(stderr, " U>"); yyval.exp = new HiByteExpression(yyvsp[0].exp); }
break; break;
case 27: case 27:
#line 72 "stella.y" #line 74 "stella.y"
{ fprintf(stderr, " ()"); yyval.exp = yyvsp[-1].exp; } { fprintf(stderr, " ()"); yyval.exp = yyvsp[-1].exp; }
break; break;
case 28: case 28:
#line 73 "stella.y" #line 75 "stella.y"
{ fprintf(stderr, " %d", yyvsp[0].val); yyval.exp = new ConstExpression(yyvsp[0].val); } { fprintf(stderr, " %d", yyvsp[0].val); yyval.exp = new ConstExpression(yyvsp[0].val); }
break; break;
case 29: case 29:
#line 74 "stella.y" #line 76 "stella.y"
{ fprintf(stderr, " %s", yyvsp[0].equate); yyval.exp = new EquateExpression(yyvsp[0].equate); } { fprintf(stderr, " %s", yyvsp[0].equate); yyval.exp = new EquateExpression(yyvsp[0].equate); }
break; break;
case 30:
#line 77 "stella.y"
{ fprintf(stderr, " (byteMeth)"); yyval.exp = new ByteMethodExpression(yyvsp[0].byteMethod); }
break;
} }
#line 705 "/usr/share/bison/bison.simple" #line 705 "/usr/share/bison/bison.simple"
@ -1284,5 +1298,5 @@ yyreturn:
#endif #endif
return yyresult; return yyresult;
} }
#line 76 "stella.y" #line 79 "stella.y"

View File

@ -5,6 +5,7 @@
typedef union { typedef union {
int val; int val;
char *equate; char *equate;
CPUDEBUG_BYTE_METHOD byteMethod;
Expression *exp; Expression *exp;
} yystype; } yystype;
# define YYSTYPE yystype # define YYSTYPE yystype
@ -12,17 +13,18 @@ typedef union {
#endif #endif
# define NUMBER 257 # define NUMBER 257
# define EQUATE 258 # define EQUATE 258
# define LOG_OR 259 # define BYTE_METHOD 259
# define LOG_AND 260 # define LOG_OR 260
# define LOG_NOT 261 # define LOG_AND 261
# define SHR 262 # define LOG_NOT 262
# define SHL 263 # define SHR 263
# define GTE 264 # define SHL 264
# define LTE 265 # define GTE 265
# define NE 266 # define LTE 266
# define EQ 267 # define NE 267
# define DEREF 268 # define EQ 268
# define UMINUS 269 # define DEREF 269
# define UMINUS 270
extern YYSTYPE yylval; extern YYSTYPE yylval;