79 #if (HARDWARE != SIMULATION)
91 #include <sys/statvfs.h>
92 #include <sys/types.h>
95 #include <sys/ioctl.h>
107 #define DEBUG_TRACE_TASK
108 #define DEBUG_TRACE_VM
112 #define IDX_BACK_BUTTON BACK_BUTTON-1
130 #if (HARDWARE != SIMULATION)
135 void setInstance(
GLOBALS * _Instance)
137 gInstance= _Instance;
149 #define PRIMDISPATHTABLE_SIZE 256
247 return (VMInstance.
pImage);
275 if (Instructions <= PRG_PRIORITY)
343 printf(
"%s",pString);
374 VMInstance.
NonVol.VolumePercent = Volume;
380 return(VMInstance.
NonVol.VolumePercent);
386 VMInstance.
NonVol.SleepMinutes = Minutes;
392 return (VMInstance.
NonVol.SleepMinutes);
402 #define ERROR(ErrorCode) [ErrorCode] = #ErrorCode
452 if (++Tmp >= ERROR_BUFFER_SIZE)
476 while ((Tmp != VMInstance.
ErrorIn) && (Result == 0))
478 if (VMInstance.
Errors[Tmp] == Error)
484 if (++Tmp >= ERROR_BUFFER_SIZE)
502 if (++VMInstance.
ErrorOut >= ERROR_BUFFER_SIZE)
699 Result = (
void*)&VMInstance.
Value;
740 Result = (
void*)(&VMInstance.
pGlobal[VMInstance.
Value]);
760 Result = (
void*)&VMInstance.
Value;
783 if (VMInstance.
Value & 0x00000080)
786 VMInstance.
Value |= 0xFFFFFF00;
796 if (VMInstance.
Value & 0x00008000)
799 VMInstance.
Value |= 0xFFFF0000;
825 Result = (
void*)*(
DATA32*)Result;
841 Result = (
void*)(&VMInstance.
pGlobal[VMInstance.
Value]);
1009 pLocals = (*VMInstance.
pObjList[Id]).pLocal;
1031 pLocals = ((
DATA8*)pLocals) + 1;
1037 #ifndef DISABLE_PAR_ALIGNMENT
1038 pLocals = (
void*)(((
IMINDEX)pLocals + 1) & ~1);
1041 pLocals = ((
DATA16*)pLocals) + 1;
1047 #ifndef DISABLE_PAR_ALIGNMENT
1048 pLocals = (
void*)(((
IMINDEX)pLocals + 3) & ~3);
1051 pLocals = ((
DATA32*)pLocals) + 1;
1057 #ifndef DISABLE_PAR_ALIGNMENT
1058 pLocals = (
void*)(((
IMINDEX)pLocals + 3) & ~3);
1061 pLocals = ((
DATAF*)pLocals) + 1;
1073 Flag = *(
DATA8*)Result;
1075 (*(
DATA8*)pLocals) = Flag;
1076 Result = ((
DATA8*)Result) + 1;
1077 pLocals = ((
DATA8*)pLocals) + 1;
1080 pLocals = ((
DATA8*)pLocals) - 1;
1081 (*(
DATA8*)pLocals) = 0;
1082 pLocals = ((
DATA8*)pLocals) + 1;
1098 pLocals = ((
DATA8*)pLocals) + 1;
1104 #ifndef DISABLE_PAR_ALIGNMENT
1105 pLocals = (
void*)(((
IMINDEX)pLocals + 1) & ~1);
1107 pLocals = ((
DATA16*)pLocals) + 1;
1113 #ifndef DISABLE_PAR_ALIGNMENT
1114 pLocals = (
void*)(((
IMINDEX)pLocals + 3) & ~3);
1116 pLocals = ((
DATA32*)pLocals) + 1;
1122 #ifndef DISABLE_PAR_ALIGNMENT
1123 pLocals = (
void*)(((
IMINDEX)pLocals + 3) & ~3);
1125 pLocals = ((
DATAF*)pLocals) + 1;
1132 pLocals = ((
DATA8*)pLocals) + Size;
1140 (*VMInstance.
pObjList[Id]).Ip = TypeIp;
1192 pLocals = ((
DATA8*)pLocals) + 1;
1198 #ifndef DISABLE_PAR_ALIGNMENT
1199 pLocals = (
void*)(((
IMINDEX)pLocals + 1) & ~1);
1202 pLocals = ((
DATA16*)pLocals) + 1;
1208 #ifndef DISABLE_PAR_ALIGNMENT
1209 pLocals = (
void*)(((
IMINDEX)pLocals + 3) & ~3);
1212 pLocals = ((
DATA32*)pLocals) + 1;
1218 #ifndef DISABLE_PAR_ALIGNMENT
1219 pLocals = (
void*)(((
IMINDEX)pLocals + 3) & ~3);
1222 pLocals = ((
DATAF*)pLocals) + 1;
1234 Flag = (*(
DATA8*)pLocals);
1236 *(
DATA8*)Result = Flag;
1237 Result = ((
DATA8*)Result) + 1;
1238 pLocals = ((
DATA8*)pLocals) + 1;
1241 Result = ((
DATA8*)Result) - 1;
1242 *(
DATA8*)Result = 0;
1258 pLocals = ((
DATA8*)pLocals) + 1;
1264 #ifndef DISABLE_PAR_ALIGNMENT
1265 pLocals = (
void*)(((
IMINDEX)pLocals + 1) & ~1);
1267 pLocals = ((
DATA16*)pLocals) + 1;
1273 #ifndef DISABLE_PAR_ALIGNMENT
1274 pLocals = (
void*)(((
IMINDEX)pLocals + 3) & ~3);
1276 pLocals = ((
DATA32*)pLocals) + 1;
1282 #ifndef DISABLE_PAR_ALIGNMENT
1283 pLocals = (
void*)(((
IMINDEX)pLocals + 3) & ~3);
1285 pLocals = ((
DATAF*)pLocals) + 1;
1292 pLocals = ((
DATA8*)pLocals) + Size;
1337 NoOfObj = (*(
IMGHEAD*)pI).NumberOfObjects;
1339 Bytes += (*(
IMGHEAD*)pI).GlobalBytes;
1340 Bytes = (Bytes + 3) & 0xFFFFFFFC;
1341 Bytes +=
sizeof(VMInstance.
pObjList) * (NoOfObj + 1);
1345 for (ObjId = 1;ObjId <= NoOfObj;ObjId++)
1347 Bytes = (Bytes + 3) & 0xFFFFFFFC;
1354 NoOfObj = (*(
IMGHEAD*)pI).NumberOfObjects;
1356 Bytes += (*(
IMGHEAD*)pI).GlobalBytes;
1357 Bytes = (Bytes + 3) & 0xFFFFFFFC;
1358 Bytes +=
sizeof(VMInstance.
pObjList) * (NoOfObj + 1);
1362 for (ObjId = 1;ObjId <= NoOfObj;ObjId++)
1364 Bytes = (Bytes + 3) & 0xFFFFFFFC;
1365 Bytes +=
sizeof(
OBJ) + pHead[ObjId].LocalBytes;
1384 RESULT Result = FAIL;
1402 if (
cMemoryOpen(PrgId,RamSize,(
void**)&pData) == OK)
1418 if (PrgId != CMD_SLOT)
1428 for (Index = 0;Index < RamSize;Index++)
1433 for (No = 0;No < MAX_BREAKPOINTS;No++)
1455 pData = &pData[(*(
IMGHEAD*)pI).GlobalBytes];
1467 for (ObjIndex = 1;ObjIndex <= VMInstance.
Program[PrgId].
Objects;ObjIndex++)
1483 if (((*VMInstance.
Program[PrgId].
pObjList[ObjIndex]).u.TriggerCount) || (ObjIndex > 1))
1499 #ifndef DISABLE_NEW_CALL_MUTEX
1524 if (PrgId == USER_SLOT)
1573 if (PrgId == USER_SLOT)
1609 if (VMInstance.
ProgramId < MAX_PROGRAMS)
1613 if (((*pProgram).Status ==
RUNNING) || ((*pProgram).Status ==
WAITING))
1615 VMInstance.
pGlobal = (*pProgram).pGlobal;
1616 VMInstance.
pImage = (*pProgram).pImage;
1617 VMInstance.
pObjHead = (*pProgram).pObjHead;
1618 VMInstance.
pObjList = (*pProgram).pObjList;
1619 VMInstance.
Objects = (*pProgram).Objects;
1620 VMInstance.
ObjectId = (*pProgram).ObjectId;
1621 VMInstance.
ObjectIp = (*pProgram).ObjectIp;
1624 VMInstance.
Debug = (*pProgram).Debug;
1639 if (VMInstance.
ProgramId < MAX_PROGRAMS)
1643 (*pProgram).pImage = VMInstance.
pImage;
1644 (*pProgram).pObjHead = VMInstance.
pObjHead;
1645 (*pProgram).pObjList = VMInstance.
pObjList;
1646 (*pProgram).Objects = VMInstance.
Objects;
1647 (*pProgram).ObjectId = VMInstance.
ObjectId;
1648 (*pProgram).ObjectIp = VMInstance.
ObjectIp;
1650 (*pProgram).InstrCnt += VMInstance.
InstrCnt;
1651 (*pProgram).Debug = VMInstance.
Debug;
1654 (*pProgram).Debug = VMInstance.
Debug;
1666 RESULT Result = STOP;
1670 for (TmpId = 0;(TmpId < MAX_PROGRAMS) && (Result == STOP);TmpId++)
1683 if (++VMInstance.
ProgramId >= MAX_PROGRAMS)
1736 VMInstance.
Priority = PRG_PRIORITY;
1807 if (++TmpId > VMInstance.
Objects)
1829 if ((Id > 0) && (Id <= VMInstance.
Objects))
1845 if ((Id > 0) && (Id <= VMInstance.
Objects))
1859 char Name[vmNAMESIZE];
1866 #ifndef DISABLE_SDCARD_SUPPORT
1868 struct statvfs Status;
1882 snprintf(Buffer,250,
"ln -s /media/card %s &> /dev/null",vmSDCARD_FOLDER);
1887 printf(
"system(%s)\r\n",Buffer);
1890 snprintf(Buffer,250,
"/media/card");
1891 statvfs(Buffer,&Status);
1895 printf(
"statvfs(%s)\r\n",Buffer);
1897 printf(
"f_bsize %ld\r\n",Status.f_bsize);
1898 printf(
"f_frsize %ld\r\n",Status.f_frsize);
1899 printf(
"f_blocks %ld\r\n",Status.f_blocks);
1900 printf(
"f_bavail %ld\r\n",Status.f_bavail);
1901 printf(
"f_files %ld\r\n",Status.f_files);
1902 printf(
"f_ffree %ld\r\n",Status.f_ffree);
1903 printf(
"f_favail %ld\r\n",Status.f_favail);
1904 printf(
"f_fside %ld\r\n",Status.f_fsid);
1905 printf(
"f_flag %ld\r\n",Status.f_flag);
1906 printf(
"f_namemax %ld\r\n",Status.f_namemax);
1909 Tmp = (
DATAF)Status.f_blocks;
1911 Tmp *= (
DATAF)Status.f_bsize;
1913 Tmp = (
DATAF)Status.f_bavail;
1915 Tmp *= (
DATAF)Status.f_bsize;
1930 snprintf(Buffer,250,
"rm -r %s &> /dev/null",vmSDCARD_FOLDER);
1936 printf(
"system(%s)\r\n",Buffer);
1967 #ifndef DISABLE_USBSTICK_SUPPORT
1969 struct statvfs Status;
1971 char Name[vmNAMESIZE];
1974 Time = VMInstance.
NewTime - VMInstance.UsbstickTimer;
1976 if ((Time >=
UPDATE_USBSTICK) || (VMInstance.UsbstickTimer == 0) || (Force))
1979 VMInstance.UsbstickTimer += Time;
1983 if (VMInstance.UsbstickOk == 0)
1985 VMInstance.UsbstickOk = 1;
1986 snprintf(Buffer,250,
"ln -s /media/usb %s &> /dev/null",vmUSBSTICK_FOLDER);
1990 #ifdef DEBUG_USBSTICK
1991 printf(
"system(%s)\r\n",Buffer);
1995 statvfs(Buffer,&Status);
1996 #ifdef DEBUG_USBSTICK
1999 printf(
"statvfs(%s)\r\n",Buffer);
2001 printf(
"f_bsize %ld\r\n",Status.f_bsize);
2002 printf(
"f_frsize %ld\r\n",Status.f_frsize);
2003 printf(
"f_blocks %ld\r\n",Status.f_blocks);
2004 printf(
"f_bavail %ld\r\n",Status.f_bavail);
2005 printf(
"f_files %ld\r\n",Status.f_files);
2006 printf(
"f_ffree %ld\r\n",Status.f_ffree);
2007 printf(
"f_favail %ld\r\n",Status.f_favail);
2008 printf(
"f_fside %ld\r\n",Status.f_fsid);
2009 printf(
"f_flag %ld\r\n",Status.f_flag);
2010 printf(
"f_namemax %ld\r\n",Status.f_namemax);
2013 Tmp = (
DATAF)Status.f_blocks;
2015 Tmp *= (
DATAF)Status.f_bsize;
2016 VMInstance.UsbstickSize = (
DATA32)Tmp;
2017 Tmp = (
DATAF)Status.f_bavail;
2019 Tmp *= (
DATAF)Status.f_bsize;
2021 #ifdef DEBUG_USBSTICK
2022 if(VMInstance.UsbstickFree != (
DATA32)Tmp)
2024 printf(
"%d T=%-8d F=%-8d\r\n",VMInstance.UsbstickOk,VMInstance.UsbstickSize,VMInstance.UsbstickFree);
2027 VMInstance.UsbstickFree = (
DATA32)Tmp;
2031 if (VMInstance.UsbstickOk == 1)
2033 VMInstance.UsbstickOk = 0;
2034 snprintf(Buffer,250,
"rm -r %s &> /dev/null",vmUSBSTICK_FOLDER);
2037 #ifdef DEBUG_USBSTICK
2040 printf(
"system(%s)\r\n",Buffer);
2044 VMInstance.UsbstickSize = 0;
2045 VMInstance.UsbstickFree = 0;
2047 #ifdef DEBUG_USBSTICK
2050 printf(
"%d T=%-8d F=%-8d\r\n",VMInstance.UsbstickOk,VMInstance.UsbstickSize,VMInstance.UsbstickFree);
2054 *pTotal = VMInstance.UsbstickSize;
2055 *pFree = VMInstance.UsbstickFree;
2056 Result = VMInstance.UsbstickOk;
2074 char PrgNameBuf[vmFILENAMESIZE];
2081 #ifdef ENABLE_STATUS_TEST
2082 VMInstance.Status = 0x00;
2085 #ifndef DISABLE_PREEMPTED_VM
2089 VMInstance.
AdcFile = open(ANALOG_DEVICE_NAME,O_RDWR | O_SYNC);
2091 if (VMInstance.
AdcFile >= MIN_HANDLE)
2093 pAdcTmp = (ANALOG*)mmap(0,
sizeof(ANALOG), PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, VMInstance.
AdcFile, 0);
2095 if (pAdcTmp == MAP_FAILED)
2119 settimeofday(&tv,
NULL);
2132 if (mkdir(vmSETTINGS_DIR,DIRPERMISSIONS) == 0)
2134 chmod(vmSETTINGS_DIR,DIRPERMISSIONS);
2142 snprintf(PrgNameBuf,vmFILENAMESIZE,
"%s/%s%s",vmSETTINGS_DIR,vmWIFI_FILE_NAME,vmEXT_TEXT);
2143 File = open(PrgNameBuf,O_CREAT | O_WRONLY | O_TRUNC,SYSPERMISSIONS);
2144 if (File >= MIN_HANDLE)
2146 sprintf(ParBuf,
"-\t");
2147 write(File,ParBuf,strlen(ParBuf));
2152 snprintf(PrgNameBuf,vmFILENAMESIZE,
"%s/%s%s",vmSETTINGS_DIR,vmBLUETOOTH_FILE_NAME,vmEXT_TEXT);
2153 File = open(PrgNameBuf,O_RDONLY);
2154 if (File >= MIN_HANDLE)
2160 File = open(PrgNameBuf,O_CREAT | O_WRONLY | O_TRUNC,SYSPERMISSIONS);
2161 if (File >= MIN_HANDLE)
2163 sprintf(ParBuf,
"-\t");
2164 write(File,ParBuf,strlen(ParBuf));
2170 snprintf(PrgNameBuf,vmFILENAMESIZE,
"%s/%s%s",vmSETTINGS_DIR,vmSLEEP_FILE_NAME,vmEXT_TEXT);
2171 File = open(PrgNameBuf,O_RDONLY);
2172 if (File >= MIN_HANDLE)
2175 read(File,ParBuf,
sizeof(ParBuf));
2176 if (sscanf(ParBuf,
"%f",&Tmp) > 0)
2178 if ((Tmp >= (
float)0) && (Tmp <= (
float)127))
2187 if (strcmp(ParBuf,
"never") == 0)
2197 File = open(PrgNameBuf,O_CREAT | O_WRONLY | O_TRUNC,SYSPERMISSIONS);
2198 if (File >= MIN_HANDLE)
2201 sprintf(ParBuf,
"%dmin\t",DEFAULT_SLEEPMINUTES);
2202 write(File,ParBuf,strlen(ParBuf));
2208 snprintf(PrgNameBuf,vmFILENAMESIZE,
"%s/%s%s",vmSETTINGS_DIR,vmVOLUME_FILE_NAME,vmEXT_TEXT);
2209 File = open(PrgNameBuf,O_RDONLY);
2210 if (File >= MIN_HANDLE)
2213 read(File,ParBuf,
sizeof(ParBuf));
2214 if (sscanf(ParBuf,
"%f",&Tmp) > 0)
2216 if ((Tmp >= (
float)0) && (Tmp <= (
float)100))
2224 #ifdef DISABLE_SOUND
2226 File = open(PrgNameBuf,O_CREAT | O_WRONLY | O_TRUNC,SYSPERMISSIONS);
2227 if (File >= MIN_HANDLE)
2229 sprintf(ParBuf,
"%d%%\t",0);
2230 write(File,ParBuf,strlen(ParBuf));
2237 File = open(PrgNameBuf,O_CREAT | O_WRONLY | O_TRUNC,SYSPERMISSIONS);
2238 if (File >= MIN_HANDLE)
2240 sprintf(ParBuf,
"%d%%\t",DEFAULT_VOLUME);
2241 write(File,ParBuf,strlen(ParBuf));
2258 for (PrgId = 0;PrgId < MAX_PROGRAMS;PrgId++)
2266 VMInstance.
Test = 0;
2268 VmPrint(
"\r\n\n\n\n\n\nLMS2012 VM STARTED\r\n{\r\n");
2271 (*pImgHead).ImageSize =
sizeof(
UiImage);
2273 #if (HARDWARE != SIMULATION)
2274 openlog(PROJECT,LOG_NDELAY,LOG_USER);
2275 syslog(LOG_INFO,
"VM Started");
2292 return (RESULT)(Result);
2298 RESULT Result = FAIL;
2301 #ifdef DEBUG_TRACE_VM
2304 #ifdef DEBUG_TRACE_FREEZE
2317 #ifdef DEBUG_TRACE_TASK
2324 #ifdef ENABLE_PERFORMANCE_TEST
2326 Time -= VMInstance.PerformTimer;
2327 VMInstance.PerformTime *= (
DATAF)199;
2328 VMInstance.PerformTime += (
DATAF)Time;
2329 VMInstance.PerformTime /= (
DATAF)200;
2334 #ifdef DEBUG_BYTECODE_TIME
2338 #ifndef DISABLE_PREEMPTED_VM
2339 (*VMInstance.
pAnalog).PreemptMilliSeconds = 0;
2341 while ((VMInstance.
Priority) && ((*VMInstance.
pAnalog).PreemptMilliSeconds < 2))
2346 if (VMInstance.
Debug)
2353 #ifdef DEBUG_TRACE_VM
2362 #ifdef DEBUG_TRACE_TASK
2373 #ifdef ENABLE_PERFORMANCE_TEST
2385 #ifdef DEBUG_BYTECODE_TIME
2386 #ifndef DISABLE_PREEMPTED_VM
2389 printf(
"%-6d %-3d %-3d\r\n",Time,(*VMInstance.
pAnalog).PreemptMilliSeconds,VMInstance.
InstrCnt);
2394 printf(
"%-6d %-3d\r\n",Time,VMInstance.
InstrCnt);
2409 #ifdef DEBUG_TRACE_FREEZE
2417 printf(
"%10.3f P=%-1d A=%5d \r\n",(
float)VMInstance.
NewTime / (
float)1000,VMInstance.
ProgramId,Addr);
2425 if (VMInstance.
Test)
2517 VmPrint(
"}\r\nVM STOPPED\r\n\n");
2519 #ifndef DISABLE_SDCARD_SUPPORT
2525 snprintf(SDBuffer,250,
"rm -r %s &> /dev/null",vmSDCARD_FOLDER);
2530 #ifndef DISABLE_USBSTICK_SUPPORT
2531 char USBBuffer[250];
2532 if (VMInstance.UsbstickOk == 1)
2535 VMInstance.UsbstickOk = 0;
2536 snprintf(USBBuffer,250,
"rm -r %s &> /dev/null",vmUSBSTICK_FOLDER);
2549 #if (HARDWARE != SIMULATION)
2555 #ifndef DISABLE_PREEMPTED_VM
2556 VMInstance.
AdcFile = open(ANALOG_DEVICE_NAME,O_RDWR | O_SYNC);
2557 if (VMInstance.
AdcFile >= MIN_HANDLE)
2559 munmap(VMInstance.
pAnalog,
sizeof(ANALOG));
2564 return (RESULT)(Result);
2568 #if (HARDWARE != SIMULATION)
2571 RESULT Result = FAIL;
2592 while (Result == OK);
2603 return ((
int)Result);
2806 [opCOM_READDATA] = &
Error,
2807 [opCOM_WRITEDATA] = &
Error,
2885 if (PrgId == GUI_SLOT)
2887 PrgId = MAX_PROGRAMS;
2897 if (PrgId == CURRENT_SLOT)
2948 if ((TmpPrgId == CMD_SLOT) || (TmpPrgId == TERM_SLOT))
3046 if ((*VMInstance.
pObjList[TmpId]).u.TriggerCount)
3048 ((*VMInstance.
pObjList[TmpId]).u.TriggerCount)--;
3049 if ((*VMInstance.
pObjList[TmpId]).u.TriggerCount == 0)
3120 OBJID ObjectIdCaller;
3137 #ifndef DISABLE_NEW_CALL_MUTEX
3144 VMInstance.
ObjectId = ObjectIdCaller;
3176 OBJID ObjectIdToCall;
3207 VMInstance.
ObjectId = ObjectIdToCall;
3218 printf(
"SUBCALL %u BUSY status = %u\r\n",ObjectIdToCall,(*VMInstance.
pObjList[ObjectIdToCall]).ObjStatus);
3222 #ifndef DISABLE_NEW_CALL_MUTEX
3223 (*VMInstance.
pObjList[ObjectIdToCall]).Blocked = 1;
3365 case GET_PRGRESULT :
3465 snprintf(VMInstance.
PrintBuffer,
PRINTBUFFERSIZE,
" PROBE Prg=%d Obj=%d Offs=%ld Lng=%ld\r\n {\r\n ",PrgId,ObjId,(
long unsigned int)RamOffset,(
long unsigned int)Size);
3468 for (Tmp = 0;(Tmp < Size) && (Tmp < Lng) && (Tmp < 1024);Tmp++)
3470 if ((Tmp & 0x0F) == 0)
3477 if (((Tmp & 0x0F) == 0xF) && (Tmp < (Size - 1)))
3527 if (PrgId != CMD_SLOT)
3562 No = *(
DATA8*)TmpIp;
3573 if ((No & 0x03) == 3)
3585 VMInstance.
Debug = 1;
3588 *(
DATA8*)TmpIp = No;
3621 if (No < MAX_BREAKPOINTS)
3678 Result = 0 - Result;
3681 Result = (((Result * (Max - Min)) + 16383) / 32767);
3739 DATA8 *pDestination;
3764 if (VMInstance.
Handle >= 0)
3774 if ((Length > Tmp) || (Length == -1))
3780 if (pDestination !=
NULL)
3792 snprintf((
char*)pDestination,Length,
"Number %02d",Number);
3924 DATA8 *pDestination;
3950 if (VMInstance.
Handle >= 0)
3952 Data32 = (
DATA32)strlen((
char*)pSource1);
3953 Data32 += (
DATA32)strlen((
char*)pSource2);
3955 if (Data32 > MIN_ARRAY_ELEMENTS)
3960 if (pDestination !=
NULL)
3962 sprintf((
char*)pDestination,
"%s%s",(
char*)pSource1,(
char*)pSource2);
3972 if (strcmp((
char*)pSource1,(
char*)pSource2) == 0)
3987 if (VMInstance.
Handle >= 0)
3989 Data32 = (
DATA32)strlen((
char*)pSource1);
3991 if (Data32 > MIN_ARRAY_ELEMENTS)
3996 if (pDestination !=
NULL)
3998 strcpy((
char*)pDestination,(
char*)pSource1);
4003 case VALUE_TO_STRING :
4009 if (VMInstance.
Handle >= 0)
4013 Data32 = (
DATA32)Figures;
4017 Data32 = (
DATA32)(0 - Figures);
4020 if (Data32 > MIN_ARRAY_ELEMENTS)
4025 if (pDestination !=
NULL)
4031 Figures = 0 - Figures;
4034 while ((Tmp < 4) && (Tmp < Figures))
4036 pDestination[Tmp] =
'-';
4039 while (Tmp < Figures)
4041 pDestination[Tmp] =
' ';
4049 while (Tmp < (Figures - 4))
4051 pDestination[Tmp] =
' ';
4054 while (Tmp < Figures)
4056 pDestination[Tmp] =
'-';
4060 pDestination[Tmp] = 0;
4066 snprintf((
char*)pDestination,Figures + 1,
"%*.*f",Figures,Decimals,DataF);
4070 Figures = 0 - Figures;
4071 snprintf((
char*)pDestination,Figures + 1,
"%.*f",Decimals,DataF);
4076 Figures = (
DATA8)strlen((
char*)pDestination);
4078 while ((Figures) && ((pDestination[Figures] ==
'0') || (pDestination[Figures] == 0)))
4080 pDestination[Figures] = 0;
4083 if (pDestination[Figures] ==
'.')
4085 pDestination[Figures] = 0;
4093 case NUMBER_TO_STRING :
4098 if (VMInstance.
Handle >= 0)
4100 Data32 = (
DATA32)Figures;
4102 if (Data32 > MIN_ARRAY_ELEMENTS)
4107 if (pDestination !=
NULL)
4109 snprintf((
char*)pDestination,Figures + 1,
"%0*d",Figures,Data16);
4114 case STRING_TO_VALUE :
4119 while (pSource1[Data16])
4121 if (pSource1[Data16] ==
',')
4123 pSource1[Data16] =
'.';
4128 sscanf((
char*)pSource1,
"%f",&DataF);
4138 if (VMInstance.
Handle >= 0)
4140 Data32 = (
DATA32)strlen((
char*)pSource1);
4142 if (Data32 > MIN_ARRAY_ELEMENTS)
4147 if (pDestination !=
NULL)
4151 if ((*pSource1 !=
' '))
4153 *pDestination = *pSource1;
4158 *pDestination = *pSource1;
4169 Start = (
DATA32)strlen((
char*)pSource2);
4170 if (VMInstance.
Handle >= 0)
4172 Data32 = (
DATA32)strlen((
char*)pSource1);
4174 if (Data32 > MIN_ARRAY_ELEMENTS)
4179 if (pDestination !=
NULL)
4181 snprintf(Buffer,1024,
"%s",strstr((
char*)pSource1,(
char*)pSource2));
4182 sprintf((
char*)pDestination,
"%s",&Buffer[(
DATA16)Start]);
4187 case VALUE_FORMATTED :
4194 snprintf(Buffer,1024,(
char*)pSource1,DataF);
4195 if (VMInstance.
Handle >= 0)
4199 if (Data32 > MIN_ARRAY_ELEMENTS)
4203 Figures = (
DATA8)Data32;
4205 if (pDestination !=
NULL)
4207 snprintf((
char*)pDestination,Figures,
"%s",Buffer);
4213 case NUMBER_FORMATTED :
4220 snprintf(Buffer,1024,(
char*)pSource1,Data32);
4221 if (VMInstance.
Handle >= 0)
4225 if (Data32 > MIN_ARRAY_ELEMENTS)
4229 Figures = (
DATA8)Data32;
4231 if (pDestination !=
NULL)
4233 snprintf((
char*)pDestination,Figures,
"%s",Buffer);
4285 if (PrgId < MAX_PROGRAMS)
4289 if ((ObjId >= 0) && (ObjId <= VMInstance.
Program[PrgId].
Objects))
4302 for (Tmp = 0;Tmp < Size;Tmp++)
4304 if ((Tmp + Offset) < Lng)
4306 Ram[Tmp + Offset] = pArray[Tmp];
4355 if (PrgId < MAX_PROGRAMS)
4359 if ((ObjId >= 0) && (ObjId <= VMInstance.
Program[PrgId].
Objects))
4372 for (Tmp = 0;Tmp < Size;Tmp++)
4374 if ((Tmp + Offset) < Lng)
4376 pArray[Tmp] = Ram[Tmp + Offset];
4405 DATA32 inputPorts = Ports;
4406 DATA8 secondPortBitfield = (
DATA8) 1 << ((inputPorts % 10) - 1);
4408 DATA8 firstPortBitfield = (
DATA8) 1 << ((inputPorts % 10) - 1);
4415 DATA8 bitfield = firstPortBitfield | secondPortBitfield;
4526 for (Note = 0;Note <
NOTES;Note++)
4528 if (strcmp((
char*)NoteFreq[Note].Note,(
char*)pNote) == 0)
4530 Freq = NoteFreq[Note].
Freq;
4537 #ifndef DISABLE_SYSTEM_BYTECODE
4557 #ifndef DISABLE_SYSTEM_BYTECODE
4558 Status = (
DATA32)system((
char*)pCmd);
4570 static ULONG SavedPriority;
4580 if (VMInstance.
Debug == 1)
4582 SavedPriority = VMInstance.
Priority;
4589 for (Lv = 0;Lv < Ln;Lv++)
4593 if (((Lv & 0x3) == 0x3) && ((Lv & 0xF) != 0xF))
4597 if (((Lv & 0xF) == 0xF) && (Lv < (Ln - 1)))
4609 for (Lv = 0;Lv < Ln;Lv++)
4613 if (((Lv & 0x3) == 0x3) && ((Lv & 0xF) != 0xF))
4617 if (((Lv & 0xF) == 0xF) && (Lv < (Ln - 1)))
4624 for (ObjId = 1;ObjId <= VMInstance.
Objects;ObjId++)
4626 switch ((*VMInstance.
pObjList[ObjId]).ObjStatus)
4665 pObjectLocal = (*VMInstance.
pObjList[ObjId]).pLocal;
4684 for (Lv = 0;Lv < Ln;Lv++)
4688 if (((Lv & 0x3) == 0x3) && ((Lv & 0xF) != 0xF))
4692 if (((Lv & 0xF) == 0xF) && (Lv < (Ln - 1)))
4708 if (VMInstance.
Debug == 2)
4715 VMInstance.
Priority = SavedPriority;
4724 VMInstance.
Priority = SavedPriority;
4727 VMInstance.
Debug = 0;
4744 RESULT Result = FAIL;
4747 if ((Time > 0) && (Time <= 30000))
4749 if (VMInstance.
Test == 0)
4751 File = open(TEST_PIN_DEVICE_NAME,O_RDWR | O_SYNC);
4752 if (File >= MIN_HANDLE)
4757 File = open(TEST_UART_DEVICE_NAME,O_RDWR | O_SYNC);
4758 if (File >= MIN_HANDLE)
4762 VMInstance.
Test = Time;
4769 VMInstance.
Test = Time;
4782 if (VMInstance.
Test != 0)
4784 File = open(TEST_UART_DEVICE_NAME,O_RDWR | O_SYNC);
4785 if (File >= MIN_HANDLE)
4790 File = open(TEST_PIN_DEVICE_NAME,O_RDWR | O_SYNC);
4791 if (File >= MIN_HANDLE)
4795 VMInstance.
Test = 0;
5174 if (Cmd == TST_OPEN)
5181 if (VMInstance.
Test)
5188 case TST_READ_PINS :
5195 File = open(TEST_PIN_DEVICE_NAME,O_RDWR | O_SYNC);
5200 for (Index = 0;Index < Tstpin.
Length;Index++)
5202 pPins[Index] = Tstpin.
String[Index];
5208 case TST_WRITE_PINS :
5215 for (Index = 0;Index < Tstpin.
Length;Index++)
5217 Tstpin.
String[Index] = pPins[Index];
5219 File = open(TEST_PIN_DEVICE_NAME,O_RDWR | O_SYNC);
5220 if (File >= MIN_HANDLE)
5234 if ((Index >= 0) && (Index < 4))
5238 if ((Index >= 4) && (Index < 8))
5242 if ((Index >= 8) && (Index < 12))
5267 case TST_ENABLE_UART :
5270 File = open(TEST_UART_DEVICE_NAME,O_RDWR | O_SYNC);
5279 case TST_DISABLE_UART :
5281 File = open(TEST_UART_DEVICE_NAME,O_RDWR | O_SYNC);
5282 if (File >= MIN_HANDLE)
5290 case TST_WRITE_UART :
5300 Tstuart.
String[Index] = pPins[Index];
5302 File = open(TEST_UART_DEVICE_NAME,O_RDWR | O_SYNC);
5303 if (File >= MIN_HANDLE)
5312 case TST_READ_UART :
5320 Tstuart.
String[Index] = 0;
5324 File = open(TEST_UART_DEVICE_NAME,O_RDWR | O_SYNC);
5325 if (File >= MIN_HANDLE)
5333 pPins[Index] = Tstuart.
String[Index];
5338 case TST_ACCU_SWITCH :
5344 if (Buffer[0] ==
'1')
5354 case TST_BOOT_MODE2:
5360 case TST_POLL_MODE2:
5367 case TST_CLOSE_MODE2:
5379 RamCheckFile = open(UPDATE_DEVICE_NAME,O_RDWR);
5381 if (RamCheckFile >= 0)
5383 read(RamCheckFile,RamStatus,2);
5384 close(RamCheckFile);
5386 if ((RamStatus[0] == ((
UBYTE)(~(RamStatus[1])))) && (0 == RamStatus[0]))
5417 void BufPrint(
char Cmd,
char *pFormat, ...)
5419 static char Buf[BUFPRINTSIZE];
5420 static ULONG BufIn = 0;
5421 static char Full = 0;
5427 #ifdef DEBUG_D_UART_ERROR
5432 va_start(pArg,pFormat);
5440 while ((pFormat[FormatIn]) && (BufIn < (BUFPRINTSIZE - 250)))
5442 Char = pFormat[FormatIn];
5443 if ((Char !=
'%') && (Par == 0))
5452 Format[FormatOut] =
Char;
5455 Format[FormatOut] = 0;
5463 BufIn += sprintf(&Buf[BufIn],
"%-3d",va_arg(pArg,
int));
5470 BufIn += sprintf(&Buf[BufIn],Format,va_arg(pArg,
double));
5477 BufIn += sprintf(&Buf[BufIn],Format,va_arg(pArg,
char *));
5495 if (BufIn >= (BUFPRINTSIZE - 250))
5497 sprintf(&Buf[BufIn],
"\r\nBUFFER FULL\r\n");
5506 printf(
"\r\n------------------------------------------------------------\r\n");
5508 if ((BufIn > 0) && (Buf[BufIn - 1] !=
'\n'))
5512 printf(
"------------------------------------------------------------\r\n\n");
5518 #ifdef DEBUG_D_UART_ERROR
5520 File = open(UART_DEVICE_NAME,O_RDONLY);
5521 if (File >= MIN_HANDLE)
5523 read(File,Buf,BUFPRINTSIZE);
5684 if ((ValidChars[*pChar] & Set) == 0)
void cMove32to32(void)
opMOVE32_32
DATA8 LogErrorNumberExists(ERR Error)
void cMathAnd16(void)
opAND16
void ObjectDeQueue(OBJID Id)
Remove object from run queue.
void cMathSub16(void)
opSUB16
void cMoveWriteF(void)
opWRITEF
void ObjectCall(void)
opCALL byte code
DSPSTAT ExecuteByteCode(IP pByteCode, GP pGlobals, LP pLocals)
Execute byte code stream (C-call)
RESULT Result
Program result (OK, BUSY, FAIL)
void SetDispatchStatus(DSPSTAT DspStat)
Set object (dispatch) status.
void cCompareLtEq16(void)
opCP_LTEQ16 byte code
void cComRead(void)
opCOM_READ byte code
UBYTE PARS
NoOfParameters type.
void cComWriteMailBox(void)
opMAILBOX_WRITE byte code
Object is halted because a call is in progress.
RESULT cValidateDisassemble(IP pI, IMINDEX *pIndex, LABEL *pLabel)
void cBranchJrTrue(void)
opJR_TRUE byte code
void PrimParAdvance(void)
Skip next encoded parameter from byte code stream.
void ObjectEnQueue(OBJID Id)
Put object on run queue.
#define OP(a, b, c, d, s, T)
void cOutputSetType(void)
opOUTPUT_SET_TYPE byte code
void AdjustObjectIp(IMOFFS Value)
Adjust current instruction pointer.
char PrintBuffer[PRINTBUFFERSIZE+1]
void cBranchJrNEq16(void)
opJR_NEQ16 byte code
ULONG IMINDEX
ImageData index type.
GP pGlobal
Pointer to start of global bytes.
void cBranchJrGtEqF(void)
opJR_GTEQF byte code
void(* PRIM)(void)
Prototype for all byte codes.
RESULT cValidateExit(void)
void cBranchJrLtEq8(void)
opJR_LTEQ8 byte code
void cMemoryFile(void)
opFILE byte code
void cBranchJrNEq32(void)
opJR_NEQ32 byte code
void cOutputTimeSync(void)
opOUTPUT_STEP_SYNC byte code
IP pImage
Pointer to start of image.
void cCompareLtEq8(void)
opCP_LTEQ8 byte code
void cSoundEntry(void)
opSOUND byte code
void cCompareSelect8(void)
opSELECT8 byte code
void ProgramInit(void)
Switch in current program ProgramId holds program to switch to.
LABEL Label[MAX_LABELS]
Storage for labels.
void cMove16to8(void)
opMOVE16_8
UBYTE VARDATA
Variable base type.
void cCompareGtEq32(void)
opCP_GTEQ32 byte code
void CleanLogErrors(void)
DATA8 GetTerminalEnable(void)
OBJHEAD * pObjHead
Pointer to start of object headers.
void cUiButton(void)
opUI_BUTTON byte code
void cCompareEq16(void)
opCP_EQ16 byte code
DATA8 CheckUsbstick(DATA8 *pChanged, DATA32 *pTotal, DATA32 *pFree, DATA8 Force)
void cTimerReaduS(void)
opTIMER_READ_US byte code
void cCompareLtF(void)
opCP_LTF byte code
SWORD DATA16
VM Type for 2 byte signed value.
void cBranchJrGt8(void)
opJR_GT8 byte code
void cMathDiv16(void)
opDIV16
void Random(void)
opRANDOM byte code
void Probe(void)
opPROBE byte code
void LogErrorNumber(ERR Err)
void Do(void)
opDO byte code
void cBranchJrEq32(void)
opJR_EQ32 byte code
void cCompareNEq16(void)
opCP_NEQ16 byte code
void cMemoryArrayWrite(void)
opARRAY_WRITE byte code
OBJID ObjectId
Active object id.
void Tst(void)
opTST byte code
void cCompareGtEq8(void)
opCP_GTEQ8 byte code
void cCompareSelect16(void)
opSELECT16 byte code
void Nop(void)
opNOP byte code
SLONG DATA32
VM Type for 4 byte signed value.
void ObjectStart(void)
opOBJECT_START byte code
UBYTE I2cGetBootStatus(void)
RESULT cMemoryGetMediaName(char *pChar, char *pName)
OBJSTAT StatusChange
Program status change.
void cMove32toF(void)
opMOVE32_F
void cBranchJrLtF(void)
opJR_LTF byte code
RESULT cMemoryArraryPointer(PRGID PrgId, HANDLER Handle, void **pMemory)
Object is waiting for final trigger.
void cCompareSelect32(void)
opSELECT32 byte code
void cMathMulF(void)
opMULF
UWORD OBJID
Object id type.
void cMove8to16(void)
opMOVE8_16
OP OpCode
Saved substituted opcode.
void cMove8to32(void)
opMOVE8_32
void SetObjectIp(IP Ip)
Set current instruction pointer.
void cMathAdd8(void)
opADD8
RESULT ValidateChar(DATA8 *pChar, DATA8 Set)
void cCompareGt16(void)
opCP_GT16 byte code
void cBranchJrNEq8(void)
opJR_NEQ8 byte code
void cBranchJrLt8(void)
opJR_LT8 byte code
void cMathAddF(void)
opADDF
void cUiRead(void)
opUI_READ byte code
void cMemoryFileName(void)
opFILENAME byte code
void cOutputReset(void)
opOUTPUT_RESET byte code
DATA16 HANDLER
Memory list index.
void cUiFlush(void)
opUI_FLUSH byte code
void cBranchJrLtEqF(void)
opJR_LTEQF byte code
ULONG Priority
Object priority.
void cCompareLtEq32(void)
opCP_LTEQ32 byte code
void cCompareSelectF(void)
opSELECTF byte code
void cBranchJrEq8(void)
opJR_EQ8 byte code
void cMove8to8(void)
opMOVE8_8
void cCompareGt8(void)
opCP_GT8 byte code
void * PrimParPointer(void)
Get next encoded parameter from byte code stream.
void cBranchJrEqF(void)
opJR_EQF byte code
void cOutputStepSpeed(void)
opOUTPUT_STEP_SPEED byte code
GP pData
Pointer to start of data.
ULONG RunTime
Program run time [uS].
IP GetObjectIp(void)
Get current instruction pointer.
OBJHEAD * pObjHead
Pointer to start of object headers.
void cMemoryArray(void)
opARRAY byte code
void ObjectWait(void)
opOBJECT_WAIT byte code
void cMemoryUsage(void)
opMEMORY_USAGE byte code
void MemoryWrite(void)
opMEMORY_WRITE byte code
DSPSTAT DispatchStatus
Dispatch status.
RESULT ObjectExec(void)
Find next object to run.
void cBranchJrNEqF(void)
opJR_NEQF byte code
void SetInstructions(ULONG Instructions)
Set instructions.
Break because of opcode break.
void cMoveRead16(void)
opREAD16
#define VMTHREADHeader(OffsetToInstructions, LocalBytes)
void cMathXor16(void)
opXOR16
void cMove16to16(void)
opMOVE16_16
OBJID CallingObjectId(void)
Get calling object id.
Break because of program stop.
void cMoveReadF(void)
opREADF
DATA8 String[TST_PIN_LENGTH+1]
DSPSTAT DispatchStatusSave
ULONG InstrCnt
Instruction counter (performance test)
#define PROGRAMHeader(VersionInfo, NumberOfObjects, GlobalBytes)
void SetSleepMinutes(DATA8 Minutes)
void cMoveFtoF(void)
opMOVEF_F
OBJSTAT ProgramStatus(PRGID PrgId)
Get program status.
OBJID Objects
No of objects in image.
void cUiWrite(void)
opUI_WRITE byte code
#define UPDATE_TIME2
Update repeat time2 [mS].
void Info(void)
opINFO byte code
IMGDATA * IP
Instruction pointer type.
RESULT TstOpen(UWORD Time)
void cMathRl32(void)
opRL32
IP GetImageStart(void)
Get pointer to actual start of byte code image.
RESULT cMemoryOpen(PRGID PrgId, GBINDEX Size, void **pMemory)
void BreakSet(void)
opBP_SET byte code
ULONG CurrentObjectIp(void)
void cOutputClrCount(void)
opOUTPUT_CLR_COUNT byte code
void GetResourcePath(char *pString, DATA8 MaxLength)
DATA8 GetSleepMinutes(void)
unsigned int ULONG
Basic Type used to symbolise 32 bit unsigned values.
void cBranchJrEq16(void)
opJR_EQ16 byte code
void cTimerReady(void)
opTIMER_READY byte code
ULONG InstrCnt
Instruction counter used for performance analyses.
void cUiKeepAlive(void)
opKEEP_ALIVE byte code
void cMathAnd32(void)
opAND32
void cTimerRead(void)
opTIMER_READ byte code
void cMemoryArrayRead(void)
opARRAY_READ byte code
void cComOpenMailBox(void)
opMAILBOX_OPEN byte code
ULONG GBINDEX
GlobalBytes index type.
void cOutputStepPower(void)
opOUTPUT_STEP_POWER byte code
void cUiTestpin(DATA8 State)
void ObjectReturn(void)
opRETURN byte code
ULONG StartTime
Program start time [mS].
void cMoveRead8(void)
opREAD8
void cComReady(void)
opCOM_READY byte code
#define PRIMPAR_CONST_SIGN
void cMoveFto8(void)
opMOVEF_8
RESULT mSchedInit(int argc, char *argv[])
#define PRIMPAR_STRING_OLD
void ObjectStop(void)
opOBJECT_STOP byte code
void ProgramExit(void)
Switch out current program ProgramId holds program to switch from.
LBINDEX LocalBytes
Number of bytes to allocate for local variables.
void cComCloseMailBox(void)
opMAILBOX_CLOSE byte code
void cMemoryArrayAppend(void)
opARRAY_APPEND byte code
RESULT cValidateInit(void)
void cMoveFto32(void)
opMOVEF_32
void cMathDivF(void)
opDIVF
DATA8 String[TST_UART_LENGTH]
void ProgramStart(void)
opPROGRAM_START byte code
void cCompareLt16(void)
opCP_LT16 byte code
void cSoundTest(void)
opSOUND_TEST byte code
#define UPDATE_USBSTICK
Update usbstick size [mS].
Break because of program break.
void cOutputStepSync(void)
opOUTPUT_STEP_SYNC byte code
void cOutputRead(void)
opOUTPUT_READ byte code
void cMathXor8(void)
opXOR8
RESULT cOutputClose(void)
void cBranchJrGtEq16(void)
opJR_GTEQ16 byte code
RESULT cMemoryClose(PRGID PrgId)
void cOutputPower(void)
opOUTPUT_POWER byte code
#define BUTTON_LONGPRESS
button long press detected
void cComWrite(void)
opCOM_WRITE byte code
int main(int argc, char *argv[])
TRIGGER TriggerCount
Trigger count used by BLOCK's trigger logic.
void cCompareLt8(void)
opCP_LT8 byte code
void * cMemoryResize(PRGID PrgId, HANDLER TmpHandle, DATA32 Elements)
TRIGGER TriggerCount
Used to determine how many triggers needed before the BLOCK object is activated.
void cOutputPolarity(void)
opOUTPUT_POLARITY byte code
void cSoundReady(void)
opSOUND_READY byte code
void cBranchJrLtEq16(void)
opJR_LTEQ16 byte code
ULONG InstrTime
Instruction time used for performance analyses.
void cCompareEq32(void)
opCP_EQ32 byte code
void Sleep(void)
opSLEEP byte code
void cBranchJrGt32(void)
opJR_GT32 byte code
OBJID OwnerObjectId
Used by BLOCK's to hold the owner id.
void cMove16toF(void)
opMOVE16_F
void cMathDiv32(void)
opDIV32
SLONG IMOFFS
ImageData offset type.
void cMoveRead32(void)
opREAD32
DSPSTAT ObjectInit(void)
Restore object context.
void cMathSub32(void)
opSUB32
void CopyLocalsToPars(OBJID Id)
Copy local variables to encoded parameters.
OBJ ** pObjList
Pointer to object pointer list.
void cMove32to8(void)
opMOVE32_8
void cMathOr32(void)
opOR32
void cMathMul8(void)
opMUL8
void cMove8toF(void)
opMOVE8_F
char ErrString[ERRORS][ERR_STRING_SIZE]
void cBranchJrGtEq32(void)
opJR_GTEQ32 byte code
void cCompareNEq32(void)
opCP_NEQ32 byte code
void ProgramEnd(PRGID PrgId)
Exit program nicely (freeing up memory)
RESULT ValidateString(DATA8 *pString, DATA8 Set)
unsigned char UBYTE
Basic Type used to symbolise 8 bit unsigned values.
void cCompareGt32(void)
opCP_GT32 byte code
void cMathSub8(void)
opSUB8
void SetTerminalEnable(DATA8 Value)
PRG Program[MAX_PROGRAMS]
Program[0] is the UI byte codes running.
void cMathDiv8(void)
opDIV8
void cMathMul16(void)
opMUL16
void cBranchJrGtF(void)
opJR_GTF byte code
void cCompareLt32(void)
opCP_LT32 byte code
#define UPDATE_SDCARD
Update sdcard size [mS].
void ObjectEnd(void)
opOBJECT_END byte code
void MemoryRead(void)
opMEMORY_READ byte code
void cBranchJr(void)
opJR byte code
void cCompareGtEq16(void)
opCP_GTEQ16 byte code
void cBranchJrLtEq32(void)
opJR_LTEQ32 byte code
FLOAT DATAF
VM Type for 4 byte floating point value.
VARDATA * LP
Local variable pointer type.
unsigned short UWORD
Basic Type used to symbolise 16 bit unsigned values.
void cOutputStop(void)
opOUTPUT_STOP byte code
UBYTE IMGDATA
Image base type.
BRKP Brkp[MAX_BREAKPOINTS]
Storage for breakpoint logic.
void ProgramInfo(void)
opPROGRAM_INFO byte code
GBINDEX GetAmountOfRamForImage(IP pI)
Get amount of ram to allocate for program.
#define UPDATE_TIME1
Update repeat time1 [mS].
IMINDEX Addr
Offset to breakpoint address from image start.
void cOutputStart(void)
opOUTPUT_START byte code
void cOutputPrgStop(void)
opOUTPUT_PRG_STOP byte code
ULONG LBINDEX
LocalBytes index type.
void cComTestMailBox(void)
opMAILBOX_TEST byte code
IP ObjectIp
Working object Ip.
void cComTest(void)
opCOM_TEST byte code
GP pGlobal
Pointer to start of global bytes.
DATA8 CheckSdcard(DATA8 *pChanged, DATA32 *pTotal, DATA32 *pFree, DATA8 Force)
void cCompareNEqF(void)
opCP_NEQF byte code
PRGID CurrentProgramId(void)
Get current program id.
void cMathRl16(void)
opRL16
void ObjectTrig(void)
opOBJECT_TRIG byte code
void Strings(void)
opSTRINGS byte code
void cBranchJrGtEq8(void)
opJR_GTEQ8 byte code
void cBranchJrLt16(void)
opJR_LT16 byte code
void cBranchJrLt32(void)
opJR_LT16 byte code
RESULT ProgramReset(PRGID PrgId, IP pI, GP pG, UBYTE Deb)
Initialise program for execution.
void * VmMemoryResize(HANDLER Handle, DATA32 Elements)
UWORD PRGID
Program id type.
void cCompareEqF(void)
opCP_EQF byte code
IP pImage
Pointer to start of image.
void cCompareLtEqF(void)
opCP_LTEQF byte code
void cOutputTest(void)
opOUTPUT_TEST byte code
OBJ ** pObjList
Pointer to object pointer list.
void cTimerWait(void)
opTIMER_WAIT byte code
void cMove32to16(void)
opMOVE32_16
void cOutputTimePower(void)
opOUTPUT_TIME_POWER byte code
void cMemoryGetResourcePath(PRGID PrgId, char *pString, DATA8 MaxLength)
LP ObjectLocal
Working object locals.
void cMove16to32(void)
opMOVE16_32
SBYTE DATA8
VM Type for 1 byte signed value.
void cComReadyMailBox(void)
opMAILBOX_READY byte code
IMINDEX Addr
Offset to breakpoint address from image start.
RESULT cSoundUpdate(void)
void cComReadMailBox(void)
opMAILBOX_READ byte code
void cOutputSpeed(void)
opOUTPUT_SPEED byte code
void cComGet(void)
opCOM_GET byte code
void ProgramStop(void)
opPROGRAM_STOP byte code
void cComSet(void)
opCOM_SET byte code
ERR Errors[ERROR_BUFFER_SIZE]
Break because of sleeping.
OBJID Objects
No of objects in image.
void cOutputTimeSpeed(void)
opOUTPUT_TIME_SPEED byte code
DATA8 FirstProgram[MAX_FILENAME_SIZE]
OBJID ObjectId
Active object id.
DATA8 GetVolumePercent(void)
void cCompareGtEqF(void)
opCP_GTEQF byte code
void DefLabel(void)
opLABEL byte code
void cBranchJrFalse(void)
opJR_FALSE byte code
void cMathMul32(void)
opMUL32
void cOutputGetCount(void)
opOUTPUT_GET_COUNT byte code
void cMathAnd8(void)
opAND8
RESULT mSchedCtrl(UBYTE *pRestart)
OBJSTAT Status
Program status.
#define PRIMDISPATHTABLE_SIZE
void cMathAdd32(void)
opADD32
#define INPUTS
Number of input ports in the system.
void cMoveWrite16(void)
opWRITE16
Object is stopped or not triggered yet.
void cMoveFto16(void)
opMOVEF_16
void ObjectExit(void)
Save object context.
void cCompareGtF(void)
opCP_GTF byte code
void VmPrint(char *pString)
void cOutputReady(void)
opOUTPUT_READY byte code
void Error(void)
opOUTPUT_READY byte code
void CopyParsToLocals(OBJID Id)
Copy encoded parameters to local variables.
VARDATA * GP
global variable pointer type
void BreakPoint(void)
opBP0 - opBP3 byte code
void cCompareEq8(void)
opCP_EQ8 byte code
Break because of waiting for completion.
void cMathOr16(void)
opOR16
void cMathSubF(void)
opSUBF
OBJSTAT ProgramStatusChange(PRGID PrgId)
Get program status change.
#define MAX_LABELS
Max number of labels per program.
RESULT cValidateProgram(PRGID PrgId, IP pI, LABEL *pLabel, DATA8 Disassemble)
Dispatcher running (looping)
void cMathAdd16(void)
opADD16
void cCompareNEq8(void)
opCP_NEQ8 byte code
PRGID ProgramId
Program id running.
PRIM PrimDispatchTabel[PRIMDISPATHTABLE_SIZE]
Dispatch table.
void cUiDraw(void)
opUI_DRAW byte code
void cBranchJrNan(void)
opJR_NAN byte code
void cUiUpdate(UWORD Time)
void cMoveInitBytes(void)
opINIT_BYTES
void cMoveWrite8(void)
opWRITE8
RESULT ProgramExec(void)
Find a program to run ProgramId holds found program.
void cMoveWrite32(void)
opWRITE32
void SetVolumePercent(DATA8 Volume)
IP OffsetToInstructions
Offset to instructions from image start.
void ObjectReset(OBJID ObjId)
Initialise object instruction pointer and trigger counter.
void cBranchJrGt16(void)
opJR_GT16 byte code
void cMathXor32(void)
opXOR32