1 #ifndef AVR_SCRIPTABLEANALYZER_H
2 #define AVR_SCRIPTABLEANALYZER_H
5 #include "script/Scriptable.h"
6 #include "script/ScriptUtil.h"
15 * @brief Scriptable Analyzer
17 * This class passes all core state changes to a script.
19 class ScriptableAnalyzer
: public Analyzer
, public script::Scriptable
{
21 ScriptableAnalyzer(Core
*core
, ScriptEngine
*vm
, const char *scriptname
);
22 ~ScriptableAnalyzer();
25 virtual void reset(unsigned int type
);
26 virtual void trace(dword address
);
27 virtual void step(lword ticks
);
30 virtual void readRegister(unsigned int r
, byte val
);
31 virtual void writeRegister(unsigned int r
, byte val
);
32 virtual void readByte(unsigned int addr
, byte val
);
33 virtual void writeByte(unsigned int addr
, byte val
);
34 virtual void readFlash(unsigned int addr
, byte val
);
35 virtual void writeFlash(unsigned int addr
, word data
);
36 virtual void fetchOperand(word val
);
39 virtual void push(byte val
);
40 virtual void pop(byte val
);
41 virtual void jump(dword address
, bool push
);
43 virtual void call(dword address
, bool push
);
44 virtual void ret(bool interrupt
);
47 virtual void sleep(unsigned int mode
);
48 virtual void systemBreak();
49 virtual void interrupt(unsigned int vector
, unsigned int addr
);
53 * When a (C++) method is called from a script, this function
54 * is executed and unique method identifier is passed as parameter.
55 * Derived classes must override this if they add new scriptable methods.
56 * @param vm Script virtual machine executing the method.
57 * @param i Unique identifier (index) of the called method.
58 * @return Number of arguments returned in the script stack.
60 int methodCall(int i
);
63 void callHelper(const char *method
);
64 void callHelper(const char *method
, float x
);
65 void callHelperb(const char *method
, bool b
);
66 void callHelper(const char *method
, float x
, float y
);
67 void callHelperb(const char *method
, float x
, bool val
);
70 const char *scriptname
;
74 static script::ScriptMethod
<ScriptableAnalyzer
> sm_methods
[];
77 int script_breakSystem(const char *funcName
);
78 int script_register(const char *funcName
);
79 int script_ioregister(const char *funcName
);
84 #endif /*AVR_SCRIPTABLEANALYZER_H*/