25 #define BYTECODE_VERSION 1.04
44 #define vmLCD_WIDTH 178
45 #define vmLCD_HEIGHT 128
46 #define vmTOPLINE_HEIGHT 10
47 #define vmLCD_STORE_LEVELS 3
49 #define vmDEFAULT_VOLUME 100
50 #define vmDEFAULT_SLEEPMINUTES 30
57 #define vmCHAIN_DEPT 4
59 #define FILEPERMISSIONS (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
60 #define DIRPERMISSIONS (S_IRWXU | S_IRWXG | S_IRWXO)
61 #define SYSPERMISSIONS (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
66 #define vmFILENAMESIZE 120
69 #define vmBTADRSIZE 13
71 #define vmERR_STRING_SIZE 32 // Inclusive zero termination
73 #define vmEVENT_BT_PIN 1
74 #define vmEVENT_BT_REQ_CONF 2
76 #define vmMAX_VALID_TYPE 101
80 #define vmMEMORY_FOLDER "/mnt/ramdisk"
81 #define vmPROGRAM_FOLDER "../prjs/BrkProg_SAVE"
82 #define vmDATALOG_FOLDER "../prjs/BrkDL_SAVE"
83 #define vmSDCARD_FOLDER "../prjs/SD_Card"
84 #define vmUSBSTICK_FOLDER "../prjs/USB_Stick"
86 #define vmPRJS_DIR "../prjs"
87 #define vmAPPS_DIR "../apps"
88 #define vmTOOLS_DIR "../tools"
89 #define vmTMP_DIR "../tmp"
91 #define vmSETTINGS_DIR "../sys/settings"
93 #define vmDIR_DEEPT 127
97 #define vmLASTRUN_FILE_NAME "lastrun"
98 #define vmCALDATA_FILE_NAME "caldata"
102 #define vmSLEEP_FILE_NAME "Sleep"
103 #define vmVOLUME_FILE_NAME "Volume"
104 #define vmWIFI_FILE_NAME "WiFi"
105 #define vmBLUETOOTH_FILE_NAME "Bluetooth"
109 #define vmEXT_SOUND ".rsf"
110 #define vmEXT_GRAPHICS ".rgf"
111 #define vmEXT_BYTECODE ".rbf"
112 #define vmEXT_TEXT ".rtf"
113 #define vmEXT_DATALOG ".rdf"
114 #define vmEXT_PROGRAM ".rpf"
115 #define vmEXT_CONFIG ".rcf"
116 #define vmEXT_ARCHIVE ".raf"
120 #define vmBRICKNAMESIZE 120
121 #define vmBTPASSKEYSIZE 7
122 #define vmWIFIPASSKEYSIZE 33
126 #define vmCHARSET_NAME 0x01
127 #define vmCHARSET_FILENAME 0x02
128 #define vmCHARSET_BTPASSKEY 0x04
129 #define vmCHARSET_WIFIPASSKEY 0x08
130 #define vmCHARSET_WIFISSID 0x10
146 opPROGRAM_STOP = 0x02,
147 opPROGRAM_START = 0x03,
148 opOBJECT_STOP = 0x04,
149 opOBJECT_START = 0x05,
150 opOBJECT_TRIG = 0x06,
151 opOBJECT_WAIT = 0x07,
156 opPROGRAM_INFO = 0x0C,
280 opPORT_CNV_OUTPUT = 0x61,
281 opPORT_CNV_INPUT = 0x62,
282 opNOTE_TO_FREQ = 0x63,
324 opMEMORY_WRITE = 0x7E,
325 opMEMORY_READ = 0x7F,
339 opTIMER_READY = 0x86,
353 opTIMER_READ_US = 0x8F,
367 opSOUND_READY = 0x96,
371 opINPUT_SAMPLE = 0x97,
374 opINPUT_DEVICE_LIST = 0x98,
375 opINPUT_DEVICE = 0x99,
378 opINPUT_READY = 0x9C,
379 opINPUT_READSI = 0x9D,
380 opINPUT_READEXT = 0x9E,
381 opINPUT_WRITE = 0x9F,
384 opOUTPUT_GET_TYPE = 0xA0,
385 opOUTPUT_SET_TYPE = 0xA1,
386 opOUTPUT_RESET = 0xA2,
387 opOUTPUT_STOP = 0xA3,
388 opOUTPUT_POWER = 0xA4,
389 opOUTPUT_SPEED = 0xA5,
390 opOUTPUT_START = 0xA6,
391 opOUTPUT_POLARITY = 0xA7,
392 opOUTPUT_READ = 0xA8,
393 opOUTPUT_TEST = 0xA9,
394 opOUTPUT_READY = 0xAA,
395 opOUTPUT_POSITION = 0xAB,
396 opOUTPUT_STEP_POWER = 0xAC,
397 opOUTPUT_TIME_POWER = 0xAD,
398 opOUTPUT_STEP_SPEED = 0xAE,
399 opOUTPUT_TIME_SPEED = 0xAF,
401 opOUTPUT_STEP_SYNC = 0xB0,
402 opOUTPUT_TIME_SYNC = 0xB1,
403 opOUTPUT_CLR_COUNT = 0xB2,
404 opOUTPUT_GET_COUNT = 0xB3,
406 opOUTPUT_PRG_STOP = 0xB4,
412 opARRAY_WRITE = 0xC2,
414 opARRAY_APPEND = 0xC4,
415 opMEMORY_USAGE = 0xC5,
435 opCOM_READDATA = 0xD1,
436 opCOM_WRITEDATA = 0xD2,
441 opCOM_WRITEFILE = 0xD7,
444 opMAILBOX_OPEN = 0xD8,
445 opMAILBOX_WRITE = 0xD9,
446 opMAILBOX_READ = 0xDA,
447 opMAILBOX_TEST = 0xDB,
448 opMAILBOX_READY = 0xDC,
449 opMAILBOX_CLOSE = 0xDD,
697 INPUT_DEVICE_SUBCODE;
717 PROGRAM_INFO_SUBCODES,
719 PROGRAM_INFO_SUBCODE;
793 SET_LOG_SYNC_TIME = 12,
795 GET_LOG_SYNC_TIME = 14,
796 GET_SUBFOLDER_NAME = 15,
801 GET_CACHE_FILES = 20,
936 NUMBER_TO_STRING = 9,
938 VALUE_FORMATTED = 11,
939 NUMBER_FORMATTED = 12,
1039 TST_WRITE_PINS = 13,
1041 TST_WRITE_UART = 15,
1043 TST_ENABLE_UART = 17,
1044 TST_DISABLE_UART = 18,
1045 TST_ACCU_SWITCH = 19,
1046 TST_BOOT_MODE2 = 20,
1047 TST_POLL_MODE2 = 21,
1048 TST_CLOSE_MODE2 = 22,
1065 BROWSE_FOLDS_FILES = 1,
1122 SICON_BT_VISIBLE = 9,
1123 SICON_BT_CONNECTED = 10,
1124 SICON_BT_CONNVISIB = 11,
1128 SICON_WIFI_CONNECTED = 15,
1151 ICON_CONNECTIONS = 11,
1152 ICON_ADD_HIDDEN = 12,
1154 ICON_VISIBILITY = 14,
1157 ICON_DISCONNECT = 17,
1162 ICON_BLUETOOTH = 22,
1167 ICON_QUESTIONMARK = 27,
1168 ICON_INFO_FILE = 28,
1170 ICON_CONNECTED = 30,
1173 ICON_OPENFOLDER = 33,
1224 ICON_FROM_FOLDER = 7,
1277 LED_GREEN_FLASH = 4,
1279 LED_ORANGE_FLASH = 6,
1280 LED_GREEN_PULSE = 7,
1282 LED_ORANGE_PULSE = 9,
1310 FILETYPE_UNKNOWN = 0x00,
1313 TYPE_BYTECODE = 0x03,
1314 TYPE_GRAPHICS = 0x04,
1315 TYPE_DATALOG = 0x05,
1316 TYPE_PROGRAM = 0x06,
1319 TYPE_USBSTICK = 0x20,
1323 TYPE_RESTART_BROWSER = -1,
1324 TYPE_REFRESH_BROWSER = -2
1492 #define DATA8_NAN ((DATA8)(-128))
1493 #define DATA16_NAN ((DATA16)(-32768))
1494 #define DATA32_NAN ((DATA32)(0x80000000))
1495 #define DATAF_NAN ((float)0 / (float)0) //(0x7FC00000)
1497 #define DATA8_MIN (-127)
1498 #define DATA8_MAX (127)
1499 #define DATA16_MIN (-32767)
1500 #define DATA16_MAX (32767)
1501 #define DATA32_MIN (-2147483647)
1502 #define DATA32_MAX (2147483647)
1503 #define DATAF_MIN (-2147483647)
1504 #define DATAF_MAX (2147483647)
1531 DEVCMD_RESET = 0x11,
1533 DEVCMD_CHANNEL = 0x12,
1547 #define vmPOP3_ABS_X 16 //
1548 #define vmPOP3_ABS_Y 50 //
1550 #define vmPOP3_ABS_WARN_ICON_X 64
1551 #define vmPOP3_ABS_WARN_ICON_X1 40
1552 #define vmPOP3_ABS_WARN_ICON_X2 72
1553 #define vmPOP3_ABS_WARN_ICON_X3 104
1554 #define vmPOP3_ABS_WARN_ICON_Y 60
1555 #define vmPOP3_ABS_WARN_SPEC_ICON_X 88
1556 #define vmPOP3_ABS_WARN_SPEC_ICON_Y 60
1557 #define vmPOP3_ABS_WARN_TEXT_X 80
1558 #define vmPOP3_ABS_WARN_TEXT_Y 68
1559 #define vmPOP3_ABS_WARN_YES_X 72
1560 #define vmPOP3_ABS_WARN_YES_Y 90
1561 #define vmPOP3_ABS_WARN_LINE_X 21
1562 #define vmPOP3_ABS_WARN_LINE_Y 89
1563 #define vmPOP3_ABS_WARN_LINE_ENDX 155
1566 #define LONGToBytes(_x) (UBYTE)((_x) & 0xFF),(UBYTE)((_x >> 8) & 0xFF),(UBYTE)((_x >> 16) & 0xFF),(UBYTE)((_x >> 24) & 0xFF)
1567 #define WORDToBytes(_x) (UBYTE)((_x) & 0xFF),(UBYTE)((_x >> 8) & 0xFF)
1568 #define BYTEToBytes(_x) (UBYTE)((_x) & 0xFF)
1570 #define PROGRAMHeader(VersionInfo,NumberOfObjects,GlobalBytes)\
1571 'L','E','G','O',LONGToBytes(0),WORDToBytes((UWORD)(BYTECODE_VERSION * 100.0)),WORDToBytes(NumberOfObjects),LONGToBytes(GlobalBytes)
1573 #define VMTHREADHeader(OffsetToInstructions,LocalBytes)\
1574 LONGToBytes(OffsetToInstructions),0,0,0,0,LONGToBytes(LocalBytes)
1576 #define SUBCALLHeader(OffsetToInstructions,LocalBytes)\
1577 LONGToBytes(OffsetToInstructions),0,0,1,0,LONGToBytes(LocalBytes)
1579 #define BLOCKHeader(OffsetToInstructions,OwnerObjectId,TriggerCount)\
1580 LONGToBytes(OffsetToInstructions),WORDToBytes(OwnerObjectId),WORDToBytes(TriggerCount),LONGToBytes(0)
1584 #define PRIMPAR_SHORT 0x00
1585 #define PRIMPAR_LONG 0x80
1587 #define PRIMPAR_CONST 0x00
1588 #define PRIMPAR_VARIABEL 0x40
1589 #define PRIMPAR_LOCAL 0x00
1590 #define PRIMPAR_GLOBAL 0x20
1591 #define PRIMPAR_HANDLE 0x10
1592 #define PRIMPAR_ADDR 0x08
1594 #define PRIMPAR_INDEX 0x1F
1595 #define PRIMPAR_CONST_SIGN 0x20
1596 #define PRIMPAR_VALUE 0x3F
1598 #define PRIMPAR_BYTES 0x07
1600 #define PRIMPAR_STRING_OLD 0
1601 #define PRIMPAR_1_BYTE 1
1602 #define PRIMPAR_2_BYTES 2
1603 #define PRIMPAR_4_BYTES 3
1604 #define PRIMPAR_STRING 4
1606 #define PRIMPAR_LABEL 0x20
1608 #define HND(x) PRIMPAR_HANDLE | x
1609 #define ADR(x) PRIMPAR_ADDR | x
1611 #define LCS (PRIMPAR_LONG | PRIMPAR_STRING)
1613 #define LAB1(v) (PRIMPAR_LONG | PRIMPAR_LABEL),(v & 0xFF)
1615 #define LC0(v) ((v & PRIMPAR_VALUE) | PRIMPAR_SHORT | PRIMPAR_CONST)
1616 #define LC1(v) (PRIMPAR_LONG | PRIMPAR_CONST | PRIMPAR_1_BYTE),(v & 0xFF)
1617 #define LC2(v) (PRIMPAR_LONG | PRIMPAR_CONST | PRIMPAR_2_BYTES),(v & 0xFF),((v >> 8) & 0xFF)
1618 #define LC4(v) (PRIMPAR_LONG | PRIMPAR_CONST | PRIMPAR_4_BYTES),((ULONG)v & 0xFF),(((ULONG)v >> (ULONG)8) & 0xFF),(((ULONG)v >> (ULONG)16) & 0xFF),(((ULONG)v >> (ULONG)24) & 0xFF)
1619 #define LCA(h) (PRIMPAR_LONG | PRIMPAR_CONST | PRIMPAR_1_BYTE | PRIMPAR_ARRAY),(i & 0xFF)
1621 #define LV0(i) ((i & PRIMPAR_INDEX) | PRIMPAR_SHORT | PRIMPAR_VARIABEL | PRIMPAR_LOCAL)
1622 #define LV1(i) (PRIMPAR_LONG | PRIMPAR_VARIABEL | PRIMPAR_LOCAL | PRIMPAR_1_BYTE),(i & 0xFF)
1623 #define LV2(i) (PRIMPAR_LONG | PRIMPAR_VARIABEL | PRIMPAR_LOCAL | PRIMPAR_2_BYTES),(i & 0xFF),((i >> 8) & 0xFF)
1624 #define LV4(i) (PRIMPAR_LONG | PRIMPAR_VARIABEL | PRIMPAR_LOCAL | PRIMPAR_4_BYTES),(i & 0xFF),((i >> 8) & 0xFF),((i >> 16) & 0xFF),((i >> 24) & 0xFF)
1625 #define LVA(h) (PRIMPAR_LONG | PRIMPAR_VARIABEL | PRIMPAR_LOCAL | PRIMPAR_1_BYTE | PRIMPAR_ARRAY),(i & 0xFF)
1627 #define GV0(i) ((i & PRIMPAR_INDEX) | PRIMPAR_SHORT | PRIMPAR_VARIABEL | PRIMPAR_GLOBAL)
1628 #define GV1(i) (PRIMPAR_LONG | PRIMPAR_VARIABEL | PRIMPAR_GLOBAL | PRIMPAR_1_BYTE),(i & 0xFF)
1629 #define GV2(i) (PRIMPAR_LONG | PRIMPAR_VARIABEL | PRIMPAR_GLOBAL | PRIMPAR_2_BYTES),(i & 0xFF),((i >> 8) & 0xFF)
1630 #define GV4(i) (PRIMPAR_LONG | PRIMPAR_VARIABEL | PRIMPAR_GLOBAL | PRIMPAR_4_BYTES),(i & 0xFF),((i >> 8) & 0xFF),((i >> 16) & 0xFF),((i >> 24) & 0xFF)
1631 #define GVA(h) (PRIMPAR_LONG | PRIMPAR_VARIABEL | PRIMPAR_GLOBAL | PRIMPAR_1_BYTE | PRIMPAR_ARRAY),(i & 0xFF)
1636 #define CALLPAR_IN 0x80
1637 #define CALLPAR_OUT 0x40
1639 #define CALLPAR_TYPE 0x07
1640 #define CALLPAR_DATA8 DATA_8
1641 #define CALLPAR_DATA16 DATA_16
1642 #define CALLPAR_DATA32 DATA_32
1643 #define CALLPAR_DATAF DATA_F
1644 #define CALLPAR_STRING DATA_S
1646 #define IN_8 (CALLPAR_IN | CALLPAR_DATA8)
1647 #define IN_16 (CALLPAR_IN | CALLPAR_DATA16)
1648 #define IN_32 (CALLPAR_IN | CALLPAR_DATA32)
1649 #define IN_F (CALLPAR_IN | CALLPAR_DATAF)
1650 #define IN_S (CALLPAR_IN | CALLPAR_STRING)
1651 #define OUT_8 (CALLPAR_OUT | CALLPAR_DATA8)
1652 #define OUT_16 (CALLPAR_OUT | CALLPAR_DATA16)
1653 #define OUT_32 (CALLPAR_OUT | CALLPAR_DATA32)
1654 #define OUT_F (CALLPAR_OUT | CALLPAR_DATAF)
1655 #define OUT_S (CALLPAR_OUT | CALLPAR_STRING)
1657 #define IO_8 IN_8 | OUT_8
1658 #define IO_16 IN_16 | OUT_16
1659 #define IO_32 IN_32 | OUT_32
1660 #define IO_F IN_F | OUT_F
1661 #define IO_S IN_S | OUT_S
Object is halted because a call is in progress.
#define OP(a, b, c, d, s, T)
Object is waiting for final trigger.
Object is stopped or not triggered yet.