Added [] operator to expression syntax. foo[bar] is exactly equivalent

to *(foo+bar), just like it is in C.

Added _bank special "variable" to expression syntax. It returns the current
bank, so you can set bankswitching breakpoints:

	breakif {_bank==1 && pc==whatever}

It looks like I'm going to be using _ as a prefix that means "special
meaning; reserved; don't use in your program", just like C does. Some
existing games might need to be rewritten if they use _bank or _scan as
a label... but it'll be well worth the price, to the game author.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@676 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
urchlay 2005-07-19 01:31:37 +00:00
parent da7801c61b
commit b1ecc27806
10 changed files with 220 additions and 122 deletions

View File

@ -0,0 +1,27 @@
//============================================================================
//
// 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: ByteDerefOffsetExpression.cxx,v 1.1 2005-07-19 01:31:36 urchlay Exp $
//============================================================================
#include "Expression.hxx"
#include "ByteDerefOffsetExpression.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteDerefOffsetExpression::ByteDerefOffsetExpression(Expression *left, Expression *right)
: Expression(left, right)
{
}

View File

@ -0,0 +1,37 @@
//============================================================================
//
// 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: ByteDerefOffsetExpression.hxx,v 1.1 2005-07-19 01:31:36 urchlay Exp $
//============================================================================
#ifndef BYTEDEREFOFFSET_EXPRESSION_HXX
#define BYTEDEREFOFFSET_EXPRESSION_HXX
#include "Debugger.hxx"
#include "Expression.hxx"
/**
@author B. Watson
@version $Id: ByteDerefOffsetExpression.hxx,v 1.1 2005-07-19 01:31:36 urchlay Exp $
*/
class ByteDerefOffsetExpression : public Expression
{
public:
ByteDerefOffsetExpression(Expression *left, Expression *right);
int evaluate() { return Debugger::debugger().peek(myLHS->evaluate() + myRHS->evaluate()); }
};
#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.cxx,v 1.4 2005-07-15 02:59:00 urchlay Exp $ // $Id: CpuDebug.cxx,v 1.5 2005-07-19 01:31:36 urchlay Exp $
//============================================================================ //============================================================================
#include "Array.hxx" #include "Array.hxx"
@ -161,6 +161,14 @@ int CpuDebug::disassemble(int address, char* buffer, EquateList* equateList)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// This doesn't really belong here (banks are Cart properties), but it
// makes like much easier for the expression parser.
int CpuDebug::getBank()
{
return Debugger::debugger().getBank();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CpuDebug::dPeek(int address) int CpuDebug::dPeek(int address)
{ {

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.6 2005-07-17 02:26:49 urchlay Exp $ // $Id: CpuDebug.hxx,v 1.7 2005-07-19 01:31:36 urchlay Exp $
//============================================================================ //============================================================================
#ifndef CPU_DEBUG_HXX #ifndef CPU_DEBUG_HXX
@ -53,6 +53,7 @@ class CpuDebug : public DebuggerSystem
int disassemble(int address, char* buffer, EquateList* equateList); int disassemble(int address, char* buffer, EquateList* equateList);
int dPeek(int address); int dPeek(int address);
int getBank();
int pc() { return mySystem->m6502().PC; } int pc() { return mySystem->m6502().PC; }
int sp() { return mySystem->m6502().SP; } int sp() { return mySystem->m6502().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.55 2005-07-18 02:03:40 urchlay Exp $ // $Id: Debugger.hxx,v 1.56 2005-07-19 01:31:36 urchlay Exp $
//============================================================================ //============================================================================
#ifndef DEBUGGER_HXX #ifndef DEBUGGER_HXX
@ -63,7 +63,7 @@ typedef uInt16 (Debugger::*DEBUGGER_WORD_METHOD)();
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.55 2005-07-18 02:03:40 urchlay Exp $ @version $Id: Debugger.hxx,v 1.56 2005-07-19 01:31:36 urchlay Exp $
*/ */
class Debugger : public DialogContainer class Debugger : public DialogContainer
{ {
@ -231,6 +231,8 @@ class Debugger : public DialogContainer
/* these are now exposed so Expressions can use them. */ /* these are now exposed so Expressions can use them. */
int peek(int addr); int peek(int addr);
int dpeek(int addr); int dpeek(int addr);
int getBank();
int bankCount();
private: private:
/** /**
@ -293,8 +295,6 @@ class Debugger : public DialogContainer
void addLabel(string label, int address); void addLabel(string label, int address);
bool setBank(int bank); bool setBank(int bank);
int bankCount();
int getBank();
const char *getCartType(); const char *getCartType();
bool patchROM(int addr, int value); bool patchROM(int addr, int value);
void saveState(int state); void saveState(int state);

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: DebuggerParser.cxx,v 1.65 2005-07-18 23:00:16 urchlay Exp $ // $Id: DebuggerParser.cxx,v 1.66 2005-07-19 01:31:36 urchlay Exp $
//============================================================================ //============================================================================
#include "bspf.hxx" #include "bspf.hxx"
@ -41,7 +41,7 @@ Command DebuggerParser::commands[] = {
"bank", "bank",
"Show # of banks (with no args), Switch to bank (with 1 arg)", "Show # of banks (with no args), Switch to bank (with 1 arg)",
false, false,
{ kARG_BYTE, kARG_END_ARGS }, { kARG_WORD, kARG_END_ARGS },
&DebuggerParser::executeBank &DebuggerParser::executeBank
}, },

View File

@ -8,6 +8,7 @@ MODULE_OBJS := \
src/debugger/CpuMethodExpression.o \ src/debugger/CpuMethodExpression.o \
src/debugger/TiaMethodExpression.o \ src/debugger/TiaMethodExpression.o \
src/debugger/ByteDerefExpression.o \ src/debugger/ByteDerefExpression.o \
src/debugger/ByteDerefOffsetExpression.o \
src/debugger/WordDerefExpression.o \ src/debugger/WordDerefExpression.o \
src/debugger/ConstExpression.o \ src/debugger/ConstExpression.o \
src/debugger/EquateExpression.o \ src/debugger/EquateExpression.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.16 2005-07-19 00:05:21 urchlay Exp $ // $Id: YaccParser.cxx,v 1.17 2005-07-19 01:31:37 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
@ -36,6 +36,7 @@
#include "CpuMethodExpression.hxx" #include "CpuMethodExpression.hxx"
#include "TiaMethodExpression.hxx" #include "TiaMethodExpression.hxx"
#include "ByteDerefExpression.hxx" #include "ByteDerefExpression.hxx"
#include "ByteDerefOffsetExpression.hxx"
#include "WordDerefExpression.hxx" #include "WordDerefExpression.hxx"
#include "ConstExpression.hxx" #include "ConstExpression.hxx"
#include "DivExpression.hxx" #include "DivExpression.hxx"
@ -119,7 +120,8 @@ inline bool is_operator(char x) {
x=='/' || x=='<' || x=='>' || x=='/' || x=='<' || x=='>' ||
x=='|' || x=='&' || x=='^' || x=='|' || x=='&' || x=='^' ||
x=='!' || x=='~' || x=='(' || x=='!' || x=='~' || x=='(' ||
x==')' || x=='=' || x=='%' ) ); x==')' || x=='=' || x=='%' ||
x=='[' || x==']' ) );
} }
// const_to_int converts a string into a number, in either the // const_to_int converts a string into a number, in either the
@ -229,6 +231,9 @@ CPUDEBUG_INT_METHOD getCpuSpecial(char *c) {
if(strcmp(c, "b") == 0) if(strcmp(c, "b") == 0)
return &CpuDebug::b; return &CpuDebug::b;
if(strcmp(c, "_bank") == 0)
return &CpuDebug::getBank;
return 0; return 0;
} }

View File

@ -48,6 +48,7 @@ void yyerror(char *e) {
%nonassoc '<' '>' GTE LTE NE EQ %nonassoc '<' '>' GTE LTE NE EQ
%nonassoc DEREF %nonassoc DEREF
%nonassoc UMINUS %nonassoc UMINUS
%nonassoc '['
%% %%
@ -80,6 +81,7 @@ expression: expression '+' expression { fprintf(stderr, " +"); $$ = new PlusExpr
| '<' expression { fprintf(stderr, " U<"); $$ = new LoByteExpression($2); lastExp = $$; } | '<' expression { fprintf(stderr, " U<"); $$ = new LoByteExpression($2); lastExp = $$; }
| '>' expression { fprintf(stderr, " U>"); $$ = new HiByteExpression($2); lastExp = $$; } | '>' expression { fprintf(stderr, " U>"); $$ = new HiByteExpression($2); lastExp = $$; }
| '(' expression ')' { fprintf(stderr, " ()"); $$ = $2; lastExp = $$; } | '(' expression ')' { fprintf(stderr, " ()"); $$ = $2; lastExp = $$; }
| expression '[' expression ']' { fprintf(stderr, " []"); $$ = new ByteDerefOffsetExpression($1, $3); lastExp = $$; }
| NUMBER { fprintf(stderr, " %d", $1); $$ = new ConstExpression($1); lastExp = $$; } | NUMBER { fprintf(stderr, " %d", $1); $$ = new ConstExpression($1); lastExp = $$; }
| EQUATE { fprintf(stderr, " %s", $1); $$ = new EquateExpression($1); lastExp = $$; } | EQUATE { fprintf(stderr, " %s", $1); $$ = new EquateExpression($1); lastExp = $$; }
| CPU_METHOD { fprintf(stderr, " (CpuMethod)"); $$ = new CpuMethodExpression($1); lastExp = $$; } | CPU_METHOD { fprintf(stderr, " (CpuMethod)"); $$ = new CpuMethodExpression($1); lastExp = $$; }

View File

@ -58,12 +58,12 @@ typedef union {
#define YYFINAL 62 #define YYFINAL 65
#define YYFLAG -32768 #define YYFLAG -32768
#define YYNTBASE 34 #define YYNTBASE 36
/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
#define YYTRANSLATE(x) ((unsigned)(x) <= 272 ? yytranslate[x] : 36) #define YYTRANSLATE(x) ((unsigned)(x) <= 272 ? yytranslate[x] : 38)
/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
static const char yytranslate[] = static const char yytranslate[] =
@ -71,16 +71,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, 30, 2, 2, 2, 12, 18, 2, 2, 2, 2, 31, 2, 2, 2, 12, 18, 2,
32, 33, 10, 9, 2, 8, 2, 11, 2, 2, 33, 34, 10, 9, 2, 8, 2, 11, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
21, 2, 22, 2, 31, 2, 2, 2, 2, 2, 21, 2, 22, 2, 32, 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, 17, 2, 2, 2, 2, 2, 2, 29, 2, 35, 17, 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, 16, 2, 29, 2, 2, 2, 2, 2, 2, 2, 16, 2, 30, 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,
@ -103,22 +103,23 @@ 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, 104,
103, 105, 107 106, 108, 110, 112
}; };
static const short yyrhs[] = static const short yyrhs[] =
{ {
35, 0, 35, 9, 35, 0, 35, 8, 35, 0, 37, 0, 37, 9, 37, 0, 37, 8, 37, 0,
35, 10, 35, 0, 35, 11, 35, 0, 35, 12, 37, 10, 37, 0, 37, 11, 37, 0, 37, 12,
35, 0, 35, 18, 35, 0, 35, 16, 35, 0, 37, 0, 37, 18, 37, 0, 37, 16, 37, 0,
35, 17, 35, 0, 35, 21, 35, 0, 35, 22, 37, 17, 37, 0, 37, 21, 37, 0, 37, 22,
35, 0, 35, 23, 35, 0, 35, 24, 35, 0, 37, 0, 37, 23, 37, 0, 37, 24, 37, 0,
35, 25, 35, 0, 35, 26, 35, 0, 35, 19, 37, 25, 37, 0, 37, 26, 37, 0, 37, 19,
35, 0, 35, 20, 35, 0, 35, 13, 35, 0, 37, 0, 37, 20, 37, 0, 37, 13, 37, 0,
35, 14, 35, 0, 8, 35, 0, 29, 35, 0, 37, 14, 37, 0, 8, 37, 0, 30, 37, 0,
30, 35, 0, 10, 35, 0, 31, 35, 0, 21, 31, 37, 0, 10, 37, 0, 32, 37, 0, 21,
35, 0, 22, 35, 0, 32, 35, 33, 0, 3, 37, 0, 22, 37, 0, 33, 37, 34, 0, 37,
0, 5, 0, 6, 0, 7, 0, 4, 0 29, 37, 35, 0, 3, 0, 5, 0, 6, 0,
7, 0, 4, 0
}; };
#endif #endif
@ -127,10 +128,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, 54, 57, 58, 59, 60, 61, 62, 63, 64, 0, 55, 58, 59, 60, 61, 62, 63, 64, 65,
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
85, 86, 87 86, 87, 88, 89
}; };
#endif #endif
@ -143,18 +144,18 @@ static const char *const yytname[] =
"$", "error", "$undefined.", "NUMBER", "ERR", "EQUATE", "CPU_METHOD", "$", "error", "$undefined.", "NUMBER", "ERR", "EQUATE", "CPU_METHOD",
"TIA_METHOD", "'-'", "'+'", "'*'", "'/'", "'%'", "LOG_OR", "LOG_AND", "TIA_METHOD", "'-'", "'+'", "'*'", "'/'", "'%'", "LOG_OR", "LOG_AND",
"LOG_NOT", "'|'", "'^'", "'&'", "SHR", "SHL", "'<'", "'>'", "GTE", "LOG_NOT", "'|'", "'^'", "'&'", "SHR", "SHL", "'<'", "'>'", "GTE",
"LTE", "NE", "EQ", "DEREF", "UMINUS", "'~'", "'!'", "'@'", "'('", "')'", "LTE", "NE", "EQ", "DEREF", "UMINUS", "'['", "'~'", "'!'", "'@'", "'('",
"statement", "expression", 0 "')'", "']'", "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, 34, 35, 35, 35, 35, 35, 35, 35, 35, 0, 36, 37, 37, 37, 37, 37, 37, 37, 37,
35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
35, 35, 35 37, 37, 37, 37
}; };
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@ -162,8 +163,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, 4, 1,
1, 1, 1 1, 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
@ -171,29 +172,29 @@ static const short yyr2[] =
error. */ error. */
static const short yydefact[] = static const short yydefact[] =
{ {
0, 28, 32, 29, 30, 31, 0, 0, 0, 0, 0, 29, 33, 30, 31, 32, 0, 0, 0, 0,
0, 0, 0, 0, 1, 20, 23, 25, 26, 21, 0, 0, 0, 0, 1, 20, 23, 25, 26, 21,
22, 24, 0, 0, 0, 0, 0, 0, 0, 0, 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,
0, 27, 3, 2, 4, 5, 6, 18, 19, 8, 0, 0, 27, 3, 2, 4, 5, 6, 18, 19,
9, 7, 16, 17, 10, 11, 12, 13, 14, 15, 8, 9, 7, 16, 17, 10, 11, 12, 13, 14,
0, 0, 0 15, 0, 28, 0, 0, 0
}; };
static const short yydefgoto[] = static const short yydefgoto[] =
{ {
60, 14 63, 14
}; };
static const short yypact[] = static const short yypact[] =
{ {
32,-32768,-32768,-32768,-32768,-32768, 32, 32, 32, 32, 33,-32768,-32768,-32768,-32768,-32768, 33, 33, 33, 33,
32, 32, 32, 32, 83,-32768,-32768, 34, 34,-32768, 33, 33, 33, 33, 114, -15, -15, -13, -13, -15,
-32768,-32768, 57, 32, 32, 32, 32, 32, 32, 32, -15, -15, 87, 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,-32768, 100, 100, 114, 114, 114, 127, 138, -10, 33, 33,-32768, 134, 134, 148, 148, 148, 162, 176,
-10, 24, 63, 63, 34, 34, 34, 34, 34, 34, 27, 27, 187, 196, 196, -13, -13, -13, -13, -13,
41, 51,-32768 -13, 59,-32768, 15, 42,-32768
}; };
static const short yypgoto[] = static const short yypgoto[] =
@ -202,49 +203,61 @@ static const short yypgoto[] =
}; };
#define YYLAST 164 #define YYLAST 225
static const short yytable[] = static const short yytable[] =
{ {
15, 16, 17, 18, 19, 20, 21, 22, 32, 33, 15, 16, 17, 18, 19, 20, 21, 22,-32768,-32768,
34, 35, 36, 37, 38, 39, 40, 42, 43, 44, -32768,-32768,-32768,-32768, 41, 64, 41, 43, 44, 45,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
55, 56, 57, 58, 59, 1, 2, 3, 4, 5, 56, 57, 58, 59, 60, 61, 1, 2, 3, 4,
6, 61, 7, 33, 34, 35, 36, 37, 38, 39, 5, 6, 65, 7, 0, 32, 33, 34, 35, 36,
40, 62, 0, 8, 9,-32768,-32768,-32768,-32768,-32768, 37, 38, 39, 40, 8, 9, 41, 0, 0, 0,
-32768, 10, 11, 12, 13, 23, 24, 25, 26, 27, 0, 0, 0, 10, 11, 12, 13, 23, 24, 25,
26, 27, 28, 29, 0, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 0, 0, 41, 0,
0, 0, 0, 0, 62, 23, 24, 25, 26, 27,
28, 29, 0, 30, 31, 32, 33, 34, 35, 36, 28, 29, 0, 30, 31, 32, 33, 34, 35, 36,
37, 38, 39, 40, 35, 36, 37, 38, 39, 40, 37, 38, 39, 40, 0, 0, 41, 0, 0, 0,
41, 23, 24, 25, 26, 27, 28, 29, 0, 30, 0, 42, 23, 24, 25, 26, 27, 28, 29, 0,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
25, 26, 27, 28, 29, 0, 30, 31, 32, 33,
34, 35, 36, 37, 38, 39, 40, 28, 29, 0,
30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 29, 0, 30, 31, 32, 33, 34, 35, 36, 40, 0, 0, 41, 25, 26, 27, 28, 29, 0,
37, 38, 39, 40, 30, 31, 32, 33, 34, 35, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
36, 37, 38, 39, 40 40, 28, 29, 41, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 0, 29, 41, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 0,
0, 41, 30, 31, 32, 33, 34, 35, 36, 37,
38, 39, 40, 0, 0, 41, 33, 34, 35, 36,
37, 38, 39, 40, 0, 0, 41, 35, 36, 37,
38, 39, 40, 0, 0, 41
}; };
static const short yycheck[] = static const short yycheck[] =
{ {
6, 7, 8, 9, 10, 11, 12, 13, 18, 19, 6, 7, 8, 9, 10, 11, 12, 13, 21, 22,
20, 21, 22, 23, 24, 25, 26, 23, 24, 25, 23, 24, 25, 26, 29, 0, 29, 23, 24, 25,
26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 3, 4, 5, 6, 7, 36, 37, 38, 39, 40, 41, 3, 4, 5, 6,
8, 0, 10, 19, 20, 21, 22, 23, 24, 25, 7, 8, 0, 10, -1, 18, 19, 20, 21, 22,
26, 0, -1, 21, 22, 21, 22, 23, 24, 25, 23, 24, 25, 26, 21, 22, 29, -1, -1, -1,
26, 29, 30, 31, 32, 8, 9, 10, 11, 12, -1, -1, -1, 30, 31, 32, 33, 8, 9, 10,
11, 12, 13, 14, -1, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, -1, -1, 29, -1,
-1, -1, -1, -1, 35, 8, 9, 10, 11, 12,
13, 14, -1, 16, 17, 18, 19, 20, 21, 22, 13, 14, -1, 16, 17, 18, 19, 20, 21, 22,
23, 24, 25, 26, 21, 22, 23, 24, 25, 26, 23, 24, 25, 26, -1, -1, 29, -1, -1, -1,
33, 8, 9, 10, 11, 12, 13, 14, -1, 16, -1, 34, 8, 9, 10, 11, 12, 13, 14, -1,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
10, 11, 12, 13, 14, -1, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 13, 14, -1,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
26, 14, -1, 16, 17, 18, 19, 20, 21, 22, 26, -1, -1, 29, 10, 11, 12, 13, 14, -1,
23, 24, 25, 26, 16, 17, 18, 19, 20, 21, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
22, 23, 24, 25, 26 26, 13, 14, 29, 16, 17, 18, 19, 20, 21,
22, 23, 24, 25, 26, -1, 14, 29, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25, 26, -1,
-1, 29, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, -1, -1, 29, 19, 20, 21, 22,
23, 24, 25, 26, -1, -1, 29, 21, 22, 23,
24, 25, 26, -1, -1, 29
}; };
/* -*-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"
@ -954,131 +967,135 @@ yyreduce:
switch (yyn) { switch (yyn) {
case 1: case 1:
#line 54 "stella.y" #line 55 "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 57 "stella.y" #line 58 "stella.y"
{ fprintf(stderr, " +"); yyval.exp = new PlusExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " +"); yyval.exp = new PlusExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 3: case 3:
#line 58 "stella.y" #line 59 "stella.y"
{ fprintf(stderr, " -"); yyval.exp = new MinusExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " -"); yyval.exp = new MinusExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 4: case 4:
#line 59 "stella.y" #line 60 "stella.y"
{ fprintf(stderr, " *"); yyval.exp = new MultExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " *"); yyval.exp = new MultExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 5: case 5:
#line 60 "stella.y" #line 61 "stella.y"
{ fprintf(stderr, " /"); yyval.exp = new DivExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " /"); yyval.exp = new DivExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 6: case 6:
#line 61 "stella.y" #line 62 "stella.y"
{ fprintf(stderr, " %%"); yyval.exp = new ModExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " %%"); yyval.exp = new ModExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 7: case 7:
#line 62 "stella.y" #line 63 "stella.y"
{ fprintf(stderr, " &"); yyval.exp = new BinAndExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " &"); yyval.exp = new BinAndExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 8: case 8:
#line 63 "stella.y" #line 64 "stella.y"
{ fprintf(stderr, " |"); yyval.exp = new BinOrExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " |"); yyval.exp = new BinOrExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 9: case 9:
#line 64 "stella.y" #line 65 "stella.y"
{ fprintf(stderr, " ^"); yyval.exp = new BinXorExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " ^"); yyval.exp = new BinXorExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 10: case 10:
#line 65 "stella.y" #line 66 "stella.y"
{ fprintf(stderr, " <"); yyval.exp = new LessExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " <"); yyval.exp = new LessExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 11: case 11:
#line 66 "stella.y" #line 67 "stella.y"
{ fprintf(stderr, " >"); yyval.exp = new GreaterExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " >"); yyval.exp = new GreaterExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 12: case 12:
#line 67 "stella.y" #line 68 "stella.y"
{ fprintf(stderr, " >="); yyval.exp = new GreaterEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " >="); yyval.exp = new GreaterEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 13: case 13:
#line 68 "stella.y" #line 69 "stella.y"
{ fprintf(stderr, " <="); yyval.exp = new LessEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " <="); yyval.exp = new LessEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 14: case 14:
#line 69 "stella.y" #line 70 "stella.y"
{ fprintf(stderr, " !="); yyval.exp = new NotEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " !="); yyval.exp = new NotEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 15: case 15:
#line 70 "stella.y" #line 71 "stella.y"
{ fprintf(stderr, " =="); yyval.exp = new EqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " =="); yyval.exp = new EqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 16: case 16:
#line 71 "stella.y" #line 72 "stella.y"
{ fprintf(stderr, " >>"); yyval.exp = new ShiftRightExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " >>"); yyval.exp = new ShiftRightExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 17: case 17:
#line 72 "stella.y" #line 73 "stella.y"
{ fprintf(stderr, " <<"); yyval.exp = new ShiftLeftExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " <<"); yyval.exp = new ShiftLeftExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 18: case 18:
#line 73 "stella.y" #line 74 "stella.y"
{ fprintf(stderr, " ||"); yyval.exp = new LogOrExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " ||"); yyval.exp = new LogOrExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 19: case 19:
#line 74 "stella.y" #line 75 "stella.y"
{ fprintf(stderr, " &&"); yyval.exp = new LogAndExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " &&"); yyval.exp = new LogAndExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 20: case 20:
#line 75 "stella.y" #line 76 "stella.y"
{ fprintf(stderr, " U-"); yyval.exp = new UnaryMinusExpression(yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " U-"); yyval.exp = new UnaryMinusExpression(yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 21: case 21:
#line 76 "stella.y" #line 77 "stella.y"
{ fprintf(stderr, " ~"); yyval.exp = new BinNotExpression(yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " ~"); yyval.exp = new BinNotExpression(yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 22: case 22:
#line 77 "stella.y" #line 78 "stella.y"
{ fprintf(stderr, " !"); yyval.exp = new LogNotExpression(yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " !"); yyval.exp = new LogNotExpression(yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 23: case 23:
#line 78 "stella.y" #line 79 "stella.y"
{ fprintf(stderr, " U*"); yyval.exp = new ByteDerefExpression(yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " U*"); yyval.exp = new ByteDerefExpression(yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 24: case 24:
#line 79 "stella.y" #line 80 "stella.y"
{ fprintf(stderr, " U@"); yyval.exp = new WordDerefExpression(yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " U@"); yyval.exp = new WordDerefExpression(yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 25: case 25:
#line 80 "stella.y" #line 81 "stella.y"
{ fprintf(stderr, " U<"); yyval.exp = new LoByteExpression(yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " U<"); yyval.exp = new LoByteExpression(yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 26: case 26:
#line 81 "stella.y" #line 82 "stella.y"
{ fprintf(stderr, " U>"); yyval.exp = new HiByteExpression(yyvsp[0].exp); lastExp = yyval.exp; } { fprintf(stderr, " U>"); yyval.exp = new HiByteExpression(yyvsp[0].exp); lastExp = yyval.exp; }
break; break;
case 27: case 27:
#line 82 "stella.y" #line 83 "stella.y"
{ fprintf(stderr, " ()"); yyval.exp = yyvsp[-1].exp; lastExp = yyval.exp; } { fprintf(stderr, " ()"); yyval.exp = yyvsp[-1].exp; lastExp = yyval.exp; }
break; break;
case 28: case 28:
#line 83 "stella.y" #line 84 "stella.y"
{ fprintf(stderr, " %d", yyvsp[0].val); yyval.exp = new ConstExpression(yyvsp[0].val); lastExp = yyval.exp; } { fprintf(stderr, " []"); yyval.exp = new ByteDerefOffsetExpression(yyvsp[-3].exp, yyvsp[-1].exp); lastExp = yyval.exp; }
break; break;
case 29: case 29:
#line 84 "stella.y" #line 85 "stella.y"
{ fprintf(stderr, " %s", yyvsp[0].equate); yyval.exp = new EquateExpression(yyvsp[0].equate); lastExp = yyval.exp; } { fprintf(stderr, " %d", yyvsp[0].val); yyval.exp = new ConstExpression(yyvsp[0].val); lastExp = yyval.exp; }
break; break;
case 30: case 30:
#line 85 "stella.y" #line 86 "stella.y"
{ fprintf(stderr, " (CpuMethod)"); yyval.exp = new CpuMethodExpression(yyvsp[0].cpuMethod); lastExp = yyval.exp; } { fprintf(stderr, " %s", yyvsp[0].equate); yyval.exp = new EquateExpression(yyvsp[0].equate); lastExp = yyval.exp; }
break; break;
case 31: case 31:
#line 86 "stella.y" #line 87 "stella.y"
{ fprintf(stderr, " (TiaMethod)"); yyval.exp = new TiaMethodExpression(yyvsp[0].tiaMethod); lastExp = yyval.exp; } { fprintf(stderr, " (CpuMethod)"); yyval.exp = new CpuMethodExpression(yyvsp[0].cpuMethod); lastExp = yyval.exp; }
break; break;
case 32: case 32:
#line 87 "stella.y" #line 88 "stella.y"
{ fprintf(stderr, " (TiaMethod)"); yyval.exp = new TiaMethodExpression(yyvsp[0].tiaMethod); lastExp = yyval.exp; }
break;
case 33:
#line 89 "stella.y"
{ fprintf(stderr, " ERR"); yyerror("Invalid label or constant"); return 1; } { fprintf(stderr, " ERR"); yyerror("Invalid label or constant"); return 1; }
break; break;
} }
@ -1314,5 +1331,5 @@ yyreturn:
#endif #endif
return yyresult; return yyresult;
} }
#line 89 "stella.y" #line 91 "stella.y"