1 #ifndef _CODESEND_H_INCL_
2 #define _CODESEND_H_INCL_
5 DVM_CAPSULE_REBOOT
= 0,
13 DVM_CAPSULE_INVALID
= 255
38 #define BASICLIB_MIN_OPCODE 0
39 #define EXT_LIB_OPCODE_OFFSET 0x80
40 #define EXTLIB0_MIN_OPCODE (EXT_LIB_OPCODE_OFFSET + 0x00)
41 #define EXTLIB1_MIN_OPCODE (EXT_LIB_OPCODE_OFFSET + 0x20)
42 #define EXTLIB2_MIN_OPCODE (EXT_LIB_OPCODE_OFFSET + 0x40)
43 #define EXTLIB3_MIN_OPCODE (EXT_LIB_OPCODE_OFFSET + 0x60)
45 #define FLOAT_PRECISION 100L
47 typedef enum { // instruction set
48 OP_HALT
= (BASICLIB_MIN_OPCODE
+ 0),
49 OP_PUSH
= (BASICLIB_MIN_OPCODE
+ 1),
50 OP_POP
= (BASICLIB_MIN_OPCODE
+ 2),
51 OP_LED
= (BASICLIB_MIN_OPCODE
+ 3),
52 OP_GETLOCAL
= (BASICLIB_MIN_OPCODE
+ 4), // 6 local variables
53 OP_BSET
= (BASICLIB_MIN_OPCODE
+ 10),
54 OP_JMP
= (BASICLIB_MIN_OPCODE
+ 11),
55 OP_RAND
= (BASICLIB_MIN_OPCODE
+ 12),
56 OP_CALL
= (BASICLIB_MIN_OPCODE
+ 13),
57 OP_POST
= (BASICLIB_MIN_OPCODE
+ 14),
58 OP_POSTNET
= (BASICLIB_MIN_OPCODE
+ 15),
59 OP_JZ
= (BASICLIB_MIN_OPCODE
+ 16),
60 OP_BCAST
= (BASICLIB_MIN_OPCODE
+ 17),
61 OP_BREADF
= (BASICLIB_MIN_OPCODE
+ 18),
62 OP_BCLEAR
= (BASICLIB_MIN_OPCODE
+ 19),
63 OP_DECR
= (BASICLIB_MIN_OPCODE
+ 20),
64 OP_SETTIMER
= (BASICLIB_MIN_OPCODE
+ 21), //21-28, 8 timers
65 OP_ADD
= (BASICLIB_MIN_OPCODE
+ 29),
66 OP_MOD
= (BASICLIB_MIN_OPCODE
+ 30),
67 OP_INCR
= (BASICLIB_MIN_OPCODE
+ 31),
68 OP_SUB
= (BASICLIB_MIN_OPCODE
+ 32),
69 OP_MUL
= (BASICLIB_MIN_OPCODE
+ 33),
70 OP_DIV
= (BASICLIB_MIN_OPCODE
+ 34),
71 OP_GET_DATA
= (BASICLIB_MIN_OPCODE
+ 35), //35-41, 7 sensors
72 OP_JGE
= (BASICLIB_MIN_OPCODE
+ 42),
73 OP_JG
= (BASICLIB_MIN_OPCODE
+ 43),
74 OP_JLE
= (BASICLIB_MIN_OPCODE
+ 44),
75 OP_JL
= (BASICLIB_MIN_OPCODE
+ 45),
76 OP_JE
= (BASICLIB_MIN_OPCODE
+ 46),
77 OP_JNE
= (BASICLIB_MIN_OPCODE
+ 47),
78 OP_JNZ
= (BASICLIB_MIN_OPCODE
+ 48),
79 OP_GETVAR
= (BASICLIB_MIN_OPCODE
+ 49), //49-56, 8 shared vars
80 OP_SETVAR
= (BASICLIB_MIN_OPCODE
+ 57), //57-64
81 OP_BPUSH
= (BASICLIB_MIN_OPCODE
+ 65), //65-68, 4 buffers
82 OP_PUSHF
= (BASICLIB_MIN_OPCODE
+ 69), // PUSHF 00 00 30 00 == 0.30
83 OP_SETVARF
= (BASICLIB_MIN_OPCODE
+ 70), // 70-76, 7 slots for float var
84 OP_GETVARF
= (BASICLIB_MIN_OPCODE
+ 77), // 77-84, 8 slots
85 OP_BAPPEND
= (BASICLIB_MIN_OPCODE
+ 85), // 85-91, 7 arguments that can be appended to a buffer
86 OP_GETLOCALF
= (BASICLIB_MIN_OPCODE
+ 92), // 92-96, 5 slots
87 OP_SETLOCALF
= (BASICLIB_MIN_OPCODE
+ 97), // 97-100, 4 slots
88 OP_SETLOCAL
= (BASICLIB_MIN_OPCODE
+ 101), // 101-106, 6 slots
89 OP_ABS
= (BASICLIB_MIN_OPCODE
+ 107),
90 OP_BZERO
= (BASICLIB_MIN_OPCODE
+ 108),
91 OP_BINIT
= (BASICLIB_MIN_OPCODE
+ 109),
92 OP_START
= (BASICLIB_MIN_OPCODE
+ 110),
93 OP_STOP
= (BASICLIB_MIN_OPCODE
+ 111),
94 OP_NOP
= (BASICLIB_MIN_OPCODE
+ 112),
96 OP_EWMA
= (EXTLIB0_MIN_OPCODE
+ 0),
97 OP_EWMADIR
= (EXTLIB1_MIN_OPCODE
+ 0),
99 OP_OUTLIER
= (EXTLIB0_MIN_OPCODE
+ 0),
100 OP_OUTDIR
= (EXTLIB1_MIN_OPCODE
+ 0),
102 OP_MOVE
= (EXTLIB1_MIN_OPCODE
+ 0),
103 OP_TURN
= (EXTLIB1_MIN_OPCODE
+ 1),
104 OP_PAN
= (EXTLIB1_MIN_OPCODE
+ 2),
105 OP_TILT
= (EXTLIB1_MIN_OPCODE
+ 3),
106 OP_SCAN
= (EXTLIB1_MIN_OPCODE
+ 4),
107 OP_SHOW_VALUE
= (EXTLIB1_MIN_OPCODE
+ 5),
108 OP_FIND_DISTANCE
= (EXTLIB1_MIN_OPCODE
+ 6),
109 OP_SALUTE
= (EXTLIB1_MIN_OPCODE
+ 7),
110 OP_FLASHLED
= (EXTLIB1_MIN_OPCODE
+ 8),
111 OP_ENABLE_CLIFF
= (EXTLIB1_MIN_OPCODE
+ 9),
112 OP_ENABLE_PUSHBUTTON
= (EXTLIB1_MIN_OPCODE
+ 10),