00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __ASEBA_CONSTS_H
00025 #define __ASEBA_CONSTS_H
00026
00031
00033 #define ASEBA_PROTOCOL_VERSION 4
00034
00036 #define ASEBA_DEFAULT_LISTEN_TARGET "tcpin:33333"
00037
00039 #define ASEBA_DEFAULT_TARGET "tcp:localhost;33333"
00040
00042 #define ASEBA_DEFAULT_HOST "localhost"
00043
00045 #define ASEBA_DEFAULT_PORT 33333
00046
00047
00049 typedef enum
00050 {
00051 ASEBA_BYTECODE_STOP = 0x0,
00052 ASEBA_BYTECODE_SMALL_IMMEDIATE = 0x1,
00053 ASEBA_BYTECODE_LARGE_IMMEDIATE = 0x2,
00054 ASEBA_BYTECODE_LOAD = 0x3,
00055 ASEBA_BYTECODE_STORE = 0x4,
00056 ASEBA_BYTECODE_LOAD_INDIRECT = 0x5,
00057 ASEBA_BYTECODE_STORE_INDIRECT = 0x6,
00058 ASEBA_BYTECODE_UNARY_ARITHMETIC = 0x7,
00059 ASEBA_BYTECODE_BINARY_ARITHMETIC = 0x8,
00060 ASEBA_BYTECODE_JUMP = 0x9,
00061 ASEBA_BYTECODE_CONDITIONAL_BRANCH = 0xA,
00062 ASEBA_BYTECODE_EMIT = 0xB,
00063 ASEBA_BYTECODE_NATIVE_CALL = 0xC,
00064 ASEBA_BYTECODE_SUB_CALL = 0xD,
00065 ASEBA_BYTECODE_SUB_RET = 0xE
00066 } AsebaBytecodeId;
00067
00069 typedef enum
00070 {
00071
00072 ASEBA_OP_SHIFT_LEFT = 0x0,
00073 ASEBA_OP_SHIFT_RIGHT,
00074 ASEBA_OP_ADD,
00075 ASEBA_OP_SUB,
00076 ASEBA_OP_MULT,
00077 ASEBA_OP_DIV,
00078 ASEBA_OP_MOD,
00079
00080 ASEBA_OP_BIT_OR,
00081 ASEBA_OP_BIT_XOR,
00082 ASEBA_OP_BIT_AND,
00083
00084 ASEBA_OP_EQUAL,
00085 ASEBA_OP_NOT_EQUAL,
00086 ASEBA_OP_BIGGER_THAN,
00087 ASEBA_OP_BIGGER_EQUAL_THAN,
00088 ASEBA_OP_SMALLER_THAN,
00089 ASEBA_OP_SMALLER_EQUAL_THAN,
00090
00091 ASEBA_OP_OR,
00092 ASEBA_OP_AND
00093 } AsebaBinaryOperator;
00094
00096 #define ASEBA_BINARY_OPERATOR_MASK 0xff
00097
00099 typedef enum
00100 {
00101 ASEBA_UNARY_OP_SUB = 0x0,
00102 ASEBA_UNARY_OP_ABS,
00103 ASEBA_UNARY_OP_BIT_NOT,
00104 ASEBA_UNARY_OP_NOT
00105 } AsebaUnaryOperator;
00106
00108 #define ASEBA_UNARY_OPERATOR_MASK 0xff
00109
00111 #define ASEBA_IF_IS_WHEN_BIT 8
00112
00113 #define ASEBA_IF_WAS_TRUE_BIT 9
00114
00116 typedef enum
00117 {
00119 ASEBA_VM_EVENT_ACTIVE_MASK = 0x1,
00121 ASEBA_VM_STEP_BY_STEP_MASK = 0x2,
00123 ASEBA_VM_EVENT_RUNNING_MASK = 0x4
00124 } AsebaExecutionStates;
00125
00127 typedef enum
00128 {
00129 ASEBA_EVENT_INIT = 0xFFFF,
00130 ASEBA_EVENT_LOCAL_EVENTS_START = 0xFFFE,
00131 } AsebaSpecialEventId;
00132
00134 #define AsebaBytecodeFromId(id) ((id) << 12)
00135
00137 typedef enum
00138 {
00139
00140 ASEBA_MESSAGE_BOOTLOADER_RESET = 0x8000,
00141 ASEBA_MESSAGE_BOOTLOADER_READ_PAGE,
00142 ASEBA_MESSAGE_BOOTLOADER_WRITE_PAGE,
00143 ASEBA_MESSAGE_BOOTLOADER_PAGE_DATA_WRITE,
00144
00145
00146 ASEBA_MESSAGE_BOOTLOADER_DESCRIPTION,
00147 ASEBA_MESSAGE_BOOTLOADER_PAGE_DATA_READ,
00148 ASEBA_MESSAGE_BOOTLOADER_ACK,
00149
00150
00151 ASEBA_MESSAGE_DESCRIPTION = 0x9000,
00152 ASEBA_MESSAGE_NAMED_VARIABLE_DESCRIPTION,
00153 ASEBA_MESSAGE_LOCAL_EVENT_DESCRIPTION,
00154 ASEBA_MESSAGE_NATIVE_FUNCTION_DESCRIPTION,
00155 ASEBA_MESSAGE_DISCONNECTED,
00156 ASEBA_MESSAGE_VARIABLES,
00157 ASEBA_MESSAGE_ARRAY_ACCESS_OUT_OF_BOUNDS,
00158 ASEBA_MESSAGE_DIVISION_BY_ZERO,
00159 ASEBA_MESSAGE_EVENT_EXECUTION_KILLED,
00160 ASEBA_MESSAGE_NODE_SPECIFIC_ERROR,
00161 ASEBA_MESSAGE_EXECUTION_STATE_CHANGED,
00162 ASEBA_MESSAGE_BREAKPOINT_SET_RESULT,
00163
00164
00165 ASEBA_MESSAGE_GET_DESCRIPTION = 0xA000,
00166
00167
00168 ASEBA_MESSAGE_SET_BYTECODE,
00169 ASEBA_MESSAGE_RESET,
00170 ASEBA_MESSAGE_RUN,
00171 ASEBA_MESSAGE_PAUSE,
00172 ASEBA_MESSAGE_STEP,
00173 ASEBA_MESSAGE_STOP,
00174 ASEBA_MESSAGE_GET_EXECUTION_STATE,
00175 ASEBA_MESSAGE_BREAKPOINT_SET,
00176 ASEBA_MESSAGE_BREAKPOINT_CLEAR,
00177 ASEBA_MESSAGE_BREAKPOINT_CLEAR_ALL,
00178 ASEBA_MESSAGE_GET_VARIABLES,
00179 ASEBA_MESSAGE_SET_VARIABLES,
00180 ASEBA_MESSAGE_WRITE_BYTECODE,
00181 ASEBA_MESSAGE_REBOOT,
00182 ASEBA_MESSAGE_SUSPEND_TO_RAM,
00183
00184 ASEBA_MESSAGE_INVALID = 0xFFFF
00185 } AsebaSystemMessagesTypes;
00186
00188 typedef enum
00189 {
00190 ASEBA_DEST_DEBUG = 0,
00191 ASEBA_DEST_INVALID = 0xFFFF
00192 } AsebaMessagesDests;
00193
00195 typedef enum
00196 {
00197 ASEBA_MAX_PACKET_SIZE = 512+6
00198 } AsebaLimits;
00199
00201 #define ASEBA_MAX_EVENT_ARG_SIZE ((ASEBA_MAX_PACKET_SIZE-6)/2)
00202
00205 #endif