diff --git a/stella/src/debugger/ByteDerefOffsetExpression.cxx b/stella/src/debugger/ByteDerefOffsetExpression.cxx new file mode 100644 index 000000000..bd5f6049b --- /dev/null +++ b/stella/src/debugger/ByteDerefOffsetExpression.cxx @@ -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) +{ +} + diff --git a/stella/src/debugger/ByteDerefOffsetExpression.hxx b/stella/src/debugger/ByteDerefOffsetExpression.hxx new file mode 100644 index 000000000..2d8745642 --- /dev/null +++ b/stella/src/debugger/ByteDerefOffsetExpression.hxx @@ -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 + diff --git a/stella/src/debugger/CpuDebug.cxx b/stella/src/debugger/CpuDebug.cxx index c28d208c1..4193ac0c8 100644 --- a/stella/src/debugger/CpuDebug.cxx +++ b/stella/src/debugger/CpuDebug.cxx @@ -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: 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" @@ -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) { diff --git a/stella/src/debugger/CpuDebug.hxx b/stella/src/debugger/CpuDebug.hxx index 1f0ca89b1..9e79b4aba 100644 --- a/stella/src/debugger/CpuDebug.hxx +++ b/stella/src/debugger/CpuDebug.hxx @@ -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: 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 @@ -53,6 +53,7 @@ class CpuDebug : public DebuggerSystem int disassemble(int address, char* buffer, EquateList* equateList); int dPeek(int address); + int getBank(); int pc() { return mySystem->m6502().PC; } int sp() { return mySystem->m6502().SP; } diff --git a/stella/src/debugger/Debugger.hxx b/stella/src/debugger/Debugger.hxx index 127b0f9e6..7a8ad9141 100644 --- a/stella/src/debugger/Debugger.hxx +++ b/stella/src/debugger/Debugger.hxx @@ -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: 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 @@ -63,7 +63,7 @@ typedef uInt16 (Debugger::*DEBUGGER_WORD_METHOD)(); for all debugging operations in Stella (parser, 6502 debugger, etc). @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 { @@ -231,6 +231,8 @@ class Debugger : public DialogContainer /* these are now exposed so Expressions can use them. */ int peek(int addr); int dpeek(int addr); + int getBank(); + int bankCount(); private: /** @@ -293,8 +295,6 @@ class Debugger : public DialogContainer void addLabel(string label, int address); bool setBank(int bank); - int bankCount(); - int getBank(); const char *getCartType(); bool patchROM(int addr, int value); void saveState(int state); diff --git a/stella/src/debugger/DebuggerParser.cxx b/stella/src/debugger/DebuggerParser.cxx index 55b1f5cb7..e1b1daf75 100644 --- a/stella/src/debugger/DebuggerParser.cxx +++ b/stella/src/debugger/DebuggerParser.cxx @@ -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: 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" @@ -41,7 +41,7 @@ Command DebuggerParser::commands[] = { "bank", "Show # of banks (with no args), Switch to bank (with 1 arg)", false, - { kARG_BYTE, kARG_END_ARGS }, + { kARG_WORD, kARG_END_ARGS }, &DebuggerParser::executeBank }, diff --git a/stella/src/debugger/module.mk b/stella/src/debugger/module.mk index 36d24cf05..56fd61c80 100644 --- a/stella/src/debugger/module.mk +++ b/stella/src/debugger/module.mk @@ -8,6 +8,7 @@ MODULE_OBJS := \ src/debugger/CpuMethodExpression.o \ src/debugger/TiaMethodExpression.o \ src/debugger/ByteDerefExpression.o \ + src/debugger/ByteDerefOffsetExpression.o \ src/debugger/WordDerefExpression.o \ src/debugger/ConstExpression.o \ src/debugger/EquateExpression.o \ diff --git a/stella/src/yacc/YaccParser.cxx b/stella/src/yacc/YaccParser.cxx index 25261a4c1..92f5eaa9f 100644 --- a/stella/src/yacc/YaccParser.cxx +++ b/stella/src/yacc/YaccParser.cxx @@ -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: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -36,6 +36,7 @@ #include "CpuMethodExpression.hxx" #include "TiaMethodExpression.hxx" #include "ByteDerefExpression.hxx" +#include "ByteDerefOffsetExpression.hxx" #include "WordDerefExpression.hxx" #include "ConstExpression.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==']' ) ); } // 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) return &CpuDebug::b; + if(strcmp(c, "_bank") == 0) + return &CpuDebug::getBank; + return 0; } diff --git a/stella/src/yacc/stella.y b/stella/src/yacc/stella.y index d5a51264f..d0e37a21c 100644 --- a/stella/src/yacc/stella.y +++ b/stella/src/yacc/stella.y @@ -48,6 +48,7 @@ void yyerror(char *e) { %nonassoc '<' '>' GTE LTE NE EQ %nonassoc DEREF %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 HiByteExpression($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 = $$; } | EQUATE { fprintf(stderr, " %s", $1); $$ = new EquateExpression($1); lastExp = $$; } | CPU_METHOD { fprintf(stderr, " (CpuMethod)"); $$ = new CpuMethodExpression($1); lastExp = $$; } diff --git a/stella/src/yacc/y.tab.c b/stella/src/yacc/y.tab.c index 2094a056d..2e80cf578 100644 --- a/stella/src/yacc/y.tab.c +++ b/stella/src/yacc/y.tab.c @@ -58,12 +58,12 @@ typedef union { -#define YYFINAL 62 +#define YYFINAL 65 #define YYFLAG -32768 -#define YYNTBASE 34 +#define YYNTBASE 36 /* 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. */ static const char yytranslate[] = @@ -71,16 +71,16 @@ static const char yytranslate[] = 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, 30, 2, 2, 2, 12, 18, 2, - 32, 33, 10, 9, 2, 8, 2, 11, 2, 2, + 2, 2, 2, 31, 2, 2, 2, 12, 18, 2, + 33, 34, 10, 9, 2, 8, 2, 11, 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, 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, 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, @@ -103,22 +103,23 @@ static const short yyprhs[] = { 0, 0, 2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62, 66, 70, - 74, 77, 80, 83, 86, 89, 92, 95, 99, 101, - 103, 105, 107 + 74, 77, 80, 83, 86, 89, 92, 95, 99, 104, + 106, 108, 110, 112 }; static const short yyrhs[] = { - 35, 0, 35, 9, 35, 0, 35, 8, 35, 0, - 35, 10, 35, 0, 35, 11, 35, 0, 35, 12, - 35, 0, 35, 18, 35, 0, 35, 16, 35, 0, - 35, 17, 35, 0, 35, 21, 35, 0, 35, 22, - 35, 0, 35, 23, 35, 0, 35, 24, 35, 0, - 35, 25, 35, 0, 35, 26, 35, 0, 35, 19, - 35, 0, 35, 20, 35, 0, 35, 13, 35, 0, - 35, 14, 35, 0, 8, 35, 0, 29, 35, 0, - 30, 35, 0, 10, 35, 0, 31, 35, 0, 21, - 35, 0, 22, 35, 0, 32, 35, 33, 0, 3, - 0, 5, 0, 6, 0, 7, 0, 4, 0 + 37, 0, 37, 9, 37, 0, 37, 8, 37, 0, + 37, 10, 37, 0, 37, 11, 37, 0, 37, 12, + 37, 0, 37, 18, 37, 0, 37, 16, 37, 0, + 37, 17, 37, 0, 37, 21, 37, 0, 37, 22, + 37, 0, 37, 23, 37, 0, 37, 24, 37, 0, + 37, 25, 37, 0, 37, 26, 37, 0, 37, 19, + 37, 0, 37, 20, 37, 0, 37, 13, 37, 0, + 37, 14, 37, 0, 8, 37, 0, 30, 37, 0, + 31, 37, 0, 10, 37, 0, 32, 37, 0, 21, + 37, 0, 22, 37, 0, 33, 37, 34, 0, 37, + 29, 37, 35, 0, 3, 0, 5, 0, 6, 0, + 7, 0, 4, 0 }; #endif @@ -127,10 +128,10 @@ static const short yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const short yyrline[] = { - 0, 54, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87 + 0, 55, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89 }; #endif @@ -143,18 +144,18 @@ static const char *const yytname[] = "$", "error", "$undefined.", "NUMBER", "ERR", "EQUATE", "CPU_METHOD", "TIA_METHOD", "'-'", "'+'", "'*'", "'/'", "'%'", "LOG_OR", "LOG_AND", "LOG_NOT", "'|'", "'^'", "'&'", "SHR", "SHL", "'<'", "'>'", "GTE", - "LTE", "NE", "EQ", "DEREF", "UMINUS", "'~'", "'!'", "'@'", "'('", "')'", - "statement", "expression", 0 + "LTE", "NE", "EQ", "DEREF", "UMINUS", "'['", "'~'", "'!'", "'@'", "'('", + "')'", "']'", "statement", "expression", 0 }; #endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const short yyr1[] = { - 0, 34, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35 + 0, 36, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37 }; /* 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, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, - 1, 1, 1 + 2, 2, 2, 2, 2, 2, 2, 3, 4, 1, + 1, 1, 1, 1 }; /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE @@ -171,29 +172,29 @@ static const short yyr2[] = error. */ 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, 22, 24, 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, - 9, 7, 16, 17, 10, 11, 12, 13, 14, 15, - 0, 0, 0 + 0, 0, 27, 3, 2, 4, 5, 6, 18, 19, + 8, 9, 7, 16, 17, 10, 11, 12, 13, 14, + 15, 0, 28, 0, 0, 0 }; static const short yydefgoto[] = { - 60, 14 + 63, 14 }; static const short yypact[] = { - 32,-32768,-32768,-32768,-32768,-32768, 32, 32, 32, 32, - 32, 32, 32, 32, 83,-32768,-32768, 34, 34,-32768, - -32768,-32768, 57, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32,-32768, 100, 100, 114, 114, 114, 127, 138, -10, - -10, 24, 63, 63, 34, 34, 34, 34, 34, 34, - 41, 51,-32768 + 33,-32768,-32768,-32768,-32768,-32768, 33, 33, 33, 33, + 33, 33, 33, 33, 114, -15, -15, -13, -13, -15, + -15, -15, 87, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33,-32768, 134, 134, 148, 148, 148, 162, 176, + 27, 27, 187, 196, 196, -13, -13, -13, -13, -13, + -13, 59,-32768, 15, 42,-32768 }; static const short yypgoto[] = @@ -202,49 +203,61 @@ static const short yypgoto[] = }; -#define YYLAST 164 +#define YYLAST 225 static const short yytable[] = { - 15, 16, 17, 18, 19, 20, 21, 22, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 1, 2, 3, 4, 5, - 6, 61, 7, 33, 34, 35, 36, 37, 38, 39, - 40, 62, 0, 8, 9,-32768,-32768,-32768,-32768,-32768, - -32768, 10, 11, 12, 13, 23, 24, 25, 26, 27, + 15, 16, 17, 18, 19, 20, 21, 22,-32768,-32768, + -32768,-32768,-32768,-32768, 41, 64, 41, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 1, 2, 3, 4, + 5, 6, 65, 7, 0, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 8, 9, 41, 0, 0, 0, + 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, - 37, 38, 39, 40, 35, 36, 37, 38, 39, 40, - 41, 23, 24, 25, 26, 27, 28, 29, 0, 30, - 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, + 37, 38, 39, 40, 0, 0, 41, 0, 0, 0, + 0, 42, 23, 24, 25, 26, 27, 28, 29, 0, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 29, 0, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40 + 40, 0, 0, 41, 25, 26, 27, 28, 29, 0, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 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[] = { - 6, 7, 8, 9, 10, 11, 12, 13, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 23, 24, 25, + 6, 7, 8, 9, 10, 11, 12, 13, 21, 22, + 23, 24, 25, 26, 29, 0, 29, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 3, 4, 5, 6, 7, - 8, 0, 10, 19, 20, 21, 22, 23, 24, 25, - 26, 0, -1, 21, 22, 21, 22, 23, 24, 25, - 26, 29, 30, 31, 32, 8, 9, 10, 11, 12, + 36, 37, 38, 39, 40, 41, 3, 4, 5, 6, + 7, 8, 0, 10, -1, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 21, 22, 29, -1, -1, -1, + -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, - 23, 24, 25, 26, 21, 22, 23, 24, 25, 26, - 33, 8, 9, 10, 11, 12, 13, 14, -1, 16, - 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, + 23, 24, 25, 26, -1, -1, 29, -1, -1, -1, + -1, 34, 8, 9, 10, 11, 12, 13, 14, -1, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 14, -1, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26 + 26, -1, -1, 29, 10, 11, 12, 13, 14, -1, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 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. */ #line 3 "/usr/share/bison/bison.simple" @@ -954,131 +967,135 @@ yyreduce: switch (yyn) { case 1: -#line 54 "stella.y" +#line 55 "stella.y" { fprintf(stderr, "\ndone\n"); result.exp = yyvsp[0].exp; } break; 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; } break; 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; } break; 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; } break; 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; } break; 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; } break; 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; } break; 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; } break; 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; } break; 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; } break; 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; } break; 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; } break; 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; } break; 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; } break; 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; } break; 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; } break; 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; } break; 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; } break; 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; } break; case 20: -#line 75 "stella.y" +#line 76 "stella.y" { fprintf(stderr, " U-"); yyval.exp = new UnaryMinusExpression(yyvsp[0].exp); lastExp = yyval.exp; } break; case 21: -#line 76 "stella.y" +#line 77 "stella.y" { fprintf(stderr, " ~"); yyval.exp = new BinNotExpression(yyvsp[0].exp); lastExp = yyval.exp; } break; case 22: -#line 77 "stella.y" +#line 78 "stella.y" { fprintf(stderr, " !"); yyval.exp = new LogNotExpression(yyvsp[0].exp); lastExp = yyval.exp; } break; case 23: -#line 78 "stella.y" +#line 79 "stella.y" { fprintf(stderr, " U*"); yyval.exp = new ByteDerefExpression(yyvsp[0].exp); lastExp = yyval.exp; } break; case 24: -#line 79 "stella.y" +#line 80 "stella.y" { fprintf(stderr, " U@"); yyval.exp = new WordDerefExpression(yyvsp[0].exp); lastExp = yyval.exp; } break; case 25: -#line 80 "stella.y" +#line 81 "stella.y" { fprintf(stderr, " U<"); yyval.exp = new LoByteExpression(yyvsp[0].exp); lastExp = yyval.exp; } break; case 26: -#line 81 "stella.y" +#line 82 "stella.y" { fprintf(stderr, " U>"); yyval.exp = new HiByteExpression(yyvsp[0].exp); lastExp = yyval.exp; } break; case 27: -#line 82 "stella.y" +#line 83 "stella.y" { fprintf(stderr, " ()"); yyval.exp = yyvsp[-1].exp; lastExp = yyval.exp; } break; case 28: -#line 83 "stella.y" -{ fprintf(stderr, " %d", yyvsp[0].val); yyval.exp = new ConstExpression(yyvsp[0].val); lastExp = yyval.exp; } +#line 84 "stella.y" +{ fprintf(stderr, " []"); yyval.exp = new ByteDerefOffsetExpression(yyvsp[-3].exp, yyvsp[-1].exp); lastExp = yyval.exp; } break; case 29: -#line 84 "stella.y" -{ fprintf(stderr, " %s", yyvsp[0].equate); yyval.exp = new EquateExpression(yyvsp[0].equate); lastExp = yyval.exp; } +#line 85 "stella.y" +{ fprintf(stderr, " %d", yyvsp[0].val); yyval.exp = new ConstExpression(yyvsp[0].val); lastExp = yyval.exp; } break; case 30: -#line 85 "stella.y" -{ fprintf(stderr, " (CpuMethod)"); yyval.exp = new CpuMethodExpression(yyvsp[0].cpuMethod); lastExp = yyval.exp; } +#line 86 "stella.y" +{ fprintf(stderr, " %s", yyvsp[0].equate); yyval.exp = new EquateExpression(yyvsp[0].equate); lastExp = yyval.exp; } break; case 31: -#line 86 "stella.y" -{ fprintf(stderr, " (TiaMethod)"); yyval.exp = new TiaMethodExpression(yyvsp[0].tiaMethod); lastExp = yyval.exp; } +#line 87 "stella.y" +{ fprintf(stderr, " (CpuMethod)"); yyval.exp = new CpuMethodExpression(yyvsp[0].cpuMethod); lastExp = yyval.exp; } break; 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; } break; } @@ -1314,5 +1331,5 @@ yyreturn: #endif return yyresult; } -#line 89 "stella.y" +#line 91 "stella.y"