LMS 2012
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
str.c
Go to the documentation of this file.
1 
10 // ALLOCATION ******************************************************************************************
11  //
12 enum // Object enummeration
13 { //
14  MAIN_ = 1, //
15  MYSUB_, //
16  OBJECTS, //
17 }; //
18  //
19  //
20 #define GLOBALS 0 // Manually sum of globals beneath
21  //
22 #define MAIN_LOCALS 11 // Manually sum of locals beneath
23 #define String1 LV1(0) // String 1 size is 5 characters + zero termination
24 #define String2 LV1(6) // String 2 is an array handle
25 #define String3 LV1(8) // String 3 is an array handle
26 #define Dummy LV1(10) // Next variable
27  //
28 #define MYSUB_LOCALS 27 // manually sum of locals beneath
29 #define In1 LV1(0) // String In1 size is 21 characters + zero termination
30 #define In2 LV1(22) // String In2 is an array handle
31 #define Out LV1(24) // String Out is an array handle
32 #define Result LV1(26) // Result for compare
33  //
34 UBYTE prg[] = // str.c
35 { //
36 // HEADER **********************************************************************************************
37  //
38  PROGRAMHeader(0,(OBJECTS - 1),GLOBALS), // VersionInfo,NumberOfObjects,GlobalBytes
39  VMTHREADHeader(0,MAIN_LOCALS), // MAIN
40  SUBCALLHeader(0,MYSUB_LOCALS), // MYSUB
41  //
42 // MAIN ************************************************************************************************
43  //
44  // VMTHREAD
45  // {
46 // opSTRINGS,LC0(DUPLICATE),LCS,'L','E','G','O',0,String1, // STRING(DUPLICATE,"LEGO",String1)
47 
48  opINIT_BYTES,String1,LC0(5),LC1('L'),LC1('E'),LC1('G'),LC1('O'),LC0(0),
49  //
50  opARRAY,LC0(CREATE8),LC0(22),String2, // ARRAY(CREATE8,22,String2)
51  opARRAY,LC0(CREATE8),LC0(22),String3, // ARRAY(CREATE8,22,String2)
52 
53  opARRAY,LC0(INIT8),String2,LC0(0),LC0(11),LC1('M'),
54  LC1('i'),LC1('n'),LC1('d'),LC1('s'),LC1('t'),
55  LC1('o'),LC1('r'),LC1('m'),LC1('s'),LC0(0),
56 
57 // opINIT_BYTES,HND(String2),LC0(11),LC1('M'),LC1('i'),LC1('n'),LC1('d'),LC1('s'),LC1('t'),
58 // LC1('o'),LC1('r'),LC1('m'),LC1('s'),LC0(0),
59  //
60 // opSTRINGS,LC0(DUPLICATE),LCS,'M','i','n','d','s','t','o', // STRING(DUPLICATE,"Mindstorms",String2)
61 // 'r','m','s',0,HND(String2), //
62  opCALL,LC0(MYSUB_),LC0(3),String1,String2,String3, // MYSUB(3,String1,String2,String3)
63  //
64  opUI_DRAW,LC0(FILLWINDOW),LC0(0),LC0(0),LC0(0), // opUI_DRAW,LC0(FILLWINDOW),LC0(0),LC0(0),LC0(0),
65  opUI_DRAW,LC0(TEXT),LC0(1),LC0(24),LC1(50),HND(String3), // UI_DRAW(TEXT,1,24,50,String3)
66  opUI_DRAW,LC0(UPDATE), // UI_DRAW(UPDATE)
67  opOBJECT_END, // }
68  //
69 // MYSUB SUBCALL ***************************************************************************************
70  //
71  0x03,IN_S,(22),IN_16,IO_16, // MYSUB(In1,In2,Out)
72  // {
73  opSTRINGS,LC0(COMPARE),In1,LCS,'L','E','G','O',0,Result, // STRING(COMPARE,In1,"LEGO",Result)
74  opJR_FALSE,Result,LC0(12), // if (Result != 0)
75  // {
76  opSTRINGS,LC0(ADD),In1,LCS,' ',0,In1, // STRING(ADD,In1," ",In1)
77  opSTRINGS,LC0(ADD),In1,HND(In2),HND(Out), // STRING(ADD,In1,In2,Out)
78  // }
79  opRETURN, // }
80  opOBJECT_END, //
81  //
82 // END *************************************************************************************************
83 };
84 
85 /* \endverbatim
86 */
#define LC1(v)
Definition: bytecodes.h:1616
UBYTE prg[]
Definition: p0.c:1
#define HND(x)
Definition: bytecodes.h:1608
#define IN_S
Definition: bytecodes.h:1650
#define VMTHREADHeader(OffsetToInstructions, LocalBytes)
Definition: bytecodes.h:1573
#define PROGRAMHeader(VersionInfo, NumberOfObjects, GlobalBytes)
Definition: bytecodes.h:1570
#define LCS
Definition: bytecodes.h:1611
#define LC0(v)
Definition: bytecodes.h:1615
unsigned char UBYTE
Basic Type used to symbolise 8 bit unsigned values.
Definition: lmstypes.h:29
#define IN_16
Definition: bytecodes.h:1647
#define SUBCALLHeader(OffsetToInstructions, LocalBytes)
Definition: bytecodes.h:1576
#define IO_16
Definition: bytecodes.h:1658