manuale Zeus

Embed Size (px)

Citation preview

  • 7/29/2019 manuale Zeus

    1/177

    Zeus Manual

    ZeusPro

    ZeusLite

    PocketZeus

    PocketZeusLite

  • 7/29/2019 manuale Zeus

    2/177

    Updates

    Software and updated manuals can be obtained from the KRMicros web site located at www.krmicros.com.

    ForumsA web-based discussions board is located at KRMicros or one one of its affiliate sites. These forums covereverything from the Dios product line to motor controller basics and robotics.

    KRMicros Return PolicyAll KRMicros Software is downloadable and free to try for a period of 15 days. After this 15 day period the softwarewill no longer function and you must purchase the software or remove it. Because we offer you a free 15 day trialperiod we offer no refunds for the software once a registration key has been purchased.

    Disclaimer of LiabilityKRMicros cannot be held responsible for any incidental, or consequential damages resulting from the use of anyKRMicros products.

    Shipping ResponsibilityMost of our products are delivered electronicaly so shipping is not an issue however in the event you purchase amanual or software on CD KRMicros ships all packages Priority Air Mail via the United States Postal Service withdelivery confirmation. We have found this combination gives the fastest and most reliable delivery at a veryreasonable cost.

    Once a package has been delivered we are no longer responsible for the package. More specifically, if some onesteals the package from your doorstep we will not be held responsible and no refund will be provided.

    If your package has not been delivered and sufficient time has passed please email us and we will verify delivery. Ifdelivery has been made you will be given the confirmation number and delivery details. Thereafter you must contactyour local Post Office for further information.

    Contactsemail: [email protected]: 703 779-9752fax: 703 779-9753web: www.krmicros.com

    Zeus ManualZeus ManualVersion 3.0

    Copyright 2006 by Michael G Simpson. All rights reserved

    http://www.krmicros.com/mailto:[email protected]://www.krmicros.com/http://www.krmicros.com/mailto:[email protected]://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    3/177

    This manual will provide a basic understanding of the Zeus Language to those beginners interested inprogramming the Zeus family of products.

    It is important that you read this document in the order that it is presented the first time through.The information is presented in a way to work you up to more complex explanations and examples.

    Zeus Language . . . . . . . . . . . . . . . . . . . . . . . .Page 5

    Zeus Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . .Page 125

    Zeus Form Builder . . . . . . . . . . . . . . . . . . . . . .Page 163

  • 7/29/2019 manuale Zeus

    4/177

    Zeus www.krmicros.comPage 4

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    5/177

    Zeus www.krmicros.com Pag

    Section 1Zeus Language

    Zeus LanguageTable of Contents

    Language Overview . . . . . . . . . . . . . . . . . . . . . .6Command Table of Contents . . . . . . . . . . . . . . .16Base Commands . . . . . . . . . . . . . . . . . . . . . . . . .18Conversion Commands . . . . . . . . . . . . . . . . . . . .42File Commands . . . . . . . . . . . . . . . . . . . . . . . . . .44Form Commands . . . . . . . . . . . . . . . . . . . . . . . .54

    Advanced Form . . . . . . . . . . . . . . . . . . . . . . . . . .70GPS Commands . . . . . . . . . . . . . . . . . . . . . . . . .74KRDB Commands . . . . . . . . . . . . . . . . . . . . . . . .80Math Commands . . . . . . . . . . . . . . . . . . . . . . . . .84Serial Commands . . . . . . . . . . . . . . . . . . . . . . . .92Socket Commands . . . . . . . . . . . . . . . . . . . . . . .104

    Zeus Extensions . . . . . . . . . . . . . . . . . . . . . . . . .121

    This section will give you 10,000 foot overview of the Zeus Language. Be sure to visit the KRMicros website forcode examples. We also have a wide range of interface boards for actual real world interfaces.

    The Zeus forums are very active and contain the most recent information regarding the Zeus language.

    The language tutorial at the end of this manual will take you step by step through the Zues language.

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    6/177

    Language Overview

    Zeus www.krmicros.comPage 6

    Functions

    The core of the Zeus language is its ability to use functions. A function is a self-contained area in the program. It has itsown variable space and when no longer needed it will free up this space.

    Functions can have any number of parameters passed to them. You can pass integer, floating point and string values to a

    function as a parameter.

    To pass a floating point value you must declare the argument as a single parameter.

    In example 1.1 the data1 parameter will expect a floating point value to be passed. If the value passed is not a floatingpoint value it will be converted.

    The next 2 parameters, data2 and data3, will expect integer values passed to them. Again, if the value passed is not aninteger values it will be converted. Notice that data3 does not have a declaration type. When the declaration type isomitted an integer value is assumed.

    In addition to local variables all functions have access to global variables. This allows you to easily manage severalhundred variables in very little space.

    Functions are totally self-contained with their own labels, gotos, gosubs and local constants.

    In example 1.2 the function mymult will take a number and multiply it by its self and return the result.

    Example 1.1

    'example 1.1

    func collect(data1 as single,data2 as integer, data3)

    endfunc

    Example 1.2

    'example 1.2

    func main()

    dim x as integer

    for x = 1 to 10

    print x,"*",x,"=",mymult(x)next

    endfunc

    func mymult(tt as integer) as integer

    exit(tt * tt)

    endfunc

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    7/177

    Language Overvie

    Zeus www.krmicros.com Pag

    Setting a Functions Return Type

    By default, when a function returns a value it returns a 32-bit integer. To return a floating point value you need to definethe function as a single value as shown in example 1.3.

    Note: If a function is set to return a float and it is used in an integer expression the floating point value will be convertedinteger. This will allow you to write generic libraries.

    Passing String Data

    When passing string or text data to a function you need to define the parameter as string as shown in example 1.4

    ImportantThe use of parentheses are NOT optional when using functions. Even when calling them with out returning values requthe use of parentheses.

    Example 1.3

    'example 1.3

    func getpie() as single

    exit(3.17)

    endfunc

    Example 1.4

    'example 1.4

    func main()

    disptext("hello")

    endfunc

    func disptext(tstr as string)

    print tstr

    goto again

    endfunc

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    8/177

    Language Overview

    Zeus www.krmicros.comPage 8

    Variables

    There are three types of variables in the Zeus language: 32-bit signed integer variables, 32-bit signed floating pointvariables, and string variables. All variables may be assigned as local or global variables.

    Local VariablesWhen a variable is local, the space it takes will be freed up once the function in which it was declared has exited. This notonly saves memory but also helps you encapsulate your functions.

    In example 2.1 the three variable slots taken up by the x,y,z variables in function displaystuff will be freed up for use byother functions once the displaystuff function has exited.

    To declare a local variable use the dim statement.

    To create an integer variable use:dim x as integerordim x

    To create a floating point variable use:dim x as single

    To create a string variable use:

    dim x as string

    Global VariablesWhen a variable has been defined as a global variable it can be accessed by all functions. Global variables never goaway.

    To declare a global variable use the statement global. Global variables may be declared anywhere, even outside functions.

    To create a global integer variable use:

    Example 2.1

    'example 2.1

    func main()

    dim myvarb1 as integer

    displaystuff()endfunc

    func displaystuff()

    dim x as integer

    dim y as integer

    dim z as integer

    print x,y,z

    endfunc

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    9/177

    Language Overvie

    Zeus www.krmicros.com Pag

    global x as integerorglobal x

    To create a global floating point variable use:global x as single

    To create a global stringt variable use:

    global x as string

    Variable ScopeIt is possible to have a global variable called zzz and a local variable called zzz. In this case the local variable will takeprecedence while in the function that created the local variable. The same is true for constants.

    Variable/Constant/Function/Label names

    Name lengthThere is no limit to the size of the names.

    Valid CharactersThe first digit in a name must be a letter or underscore. After the first digit is defined you may use numbers in the name

    How manyThe amount of available RAM determines the actual number of variables that can be active. That is to say you can havseveral local variables defined but if the function is not currently being called the variable does not take any space.

    You may have up to 1,000,000 string variables, 1,000,000 integer variables, and 1,000,000 floating point variables. Thelimits only apply to local variables so each function may have this many variables.

    Constants

    Constants are numbers that are referenced by a useable name. For example, const CLK 5 would allow us to use the wCLK to represent the number 5. That way you can have several references to the CLK port. To change the port from 5 means only having to change 1 line of code as shown in example 2.2.

    Once a constant has been defined the value cannot be changed. In other words you can't have the statement CLK = 25

    Constant statements are local to the functions that they were declared, just like local variables.

    Example 2.2

    'example 2.2

    func main()

    const CLK 5

    print CLKprint int(CLK *5)

    endfunc

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    10/177

    Language Overview

    Zeus www.krmicros.comPage 10

    Global Constants

    You can also define global constants, i.e constants that are available to all functions. To define a global constant use thegconst statement just like you would use the const as shown above.

    Global constants can be defined anywhere in the program file.

    Note: Constants may hold both floating point and integer values. They cannot hold string values.

    MATH

    The Zeus language supports two types of math: 32-bit integer math and 32-bit floating point math. In many cases the twoare interchangeable but there are some subtle differences.

    Integer Math

    The following operations are supported:

    * Multiplication\ Division Truncate Result with remainder/ Division Rounded result with remainder+ Addition- Subtraction& And| Or^ Xor// Return the Remainder after a Division

    You can use math anywhere an expression is used or in variable assignments.

    Example:

    dim res as integerres = 10 + 5

    Floating Point MathFloating point math is very similar to integer math.

    The following operations are supported

    * Multiplication\ Division result is truncated to integer. Decimal is chopped off./ Normal floating point division+ Addition- Subtraction& And| Or^ Xor// Return the Remainder after a Division

    You can use math anywhere an expression is expected.

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    11/177

    Language Overvie

    Zeus www.krmicros.com Page

    String Math

    There are a couple operators that are supported when working with strings.

    + Add strings- Subtract the contents of the string on the right side if it exists on the left side.

    Math and Expression Conversion

    By its nature Zeus will automatically convert one data type to another. This is fairly strait forward when working withintegers and floating point numbers. However Zeus will also attempt to convert to and from strings as well.

    dim tstr as stringdim x as integer

    x = 25tstr = xprint tstr

    In the above example the integer variable will be converted to the string as 25 so will print 25.

    dim tstr as stringdim x as integerdim y as integer

    x = 25

    y = 75tstr = x+yprint tstr

    In this example the x value will be placed in the string as 25 and the y value will be added to the string as 75 with thresult being 2575. This is because string math is being used. If you actually wanted to add x and y you need to force compiler to use integer math when adding x and y as shown here.

    x = 25y = 75tstr = int(x+y)print tstr

    What affects the type of expression math to be used? When doing assignment to a variable the variable type willdetermine the type of expression math used. If using an expression in a function or command parameter then theexpected type will determine the math used.

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    12/177

    Language Overview

    Zeus www.krmicros.comPage 12

    Conversion Options

    You can set how the Zeus language handles conversions by setting various conversion options.

    option cvtstringtoint xxxoption cvtstringtosingle xxxoption cvtsingletoint xxxoption cvtsingletostring xxxoption cvtinttosingle xxxoption cvtinttostring xxx

    Where xxx is the type of conversion to allow.

    autoWill cause an automatic conversion from one type variable to another. You can alwaysoverride this with the cint/csng/cstr/val commands

    warnWill do the same as auto but will cause warnings to be generated.

    errorWill stop the compiler with an error

    There are also three global settings

    option cvtautoplaces the compiler in automode (The default mode)

    option cvtwarnCauses a warning.

    option cvterror

    Causes an error

    Constant Conversion

    The compiler supports three types of number or constant conversion.

    Binary ConversionYou can assign a binary number to a variable or as part of an expression by preceding the number with a %.

    Example:res = %100

    res will contain 4. Note that the MSB is on the left side.

    Hex ConversionYou can assign a hexadecimal number to a variable or as part of an expression by preceding the number with a $.

    Example:res = $41

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    13/177

    Language Overvie

    Zeus www.krmicros.com Page

    res will contain 65.

    ASCII conversionYou can convert an ASCII character to a byte by enclosing the character in single quotes.

    Example:res = 'A'

    res will contain 65

    Error Handling

    There are 4 modes for handling runtime errors. These are errors that are not handled by the compiler.

    onerror goto labelWill case the engine to jump to the label after the error has completed. The label must be located in the function whereerror is expected.

    onerror console (default)Will display an error message in the console window.

    onerror resumeNo action is take the program just keeps running ignoring the error.

    onerror noneNo action is taken at the command level. The current function will exit and a message will be displayed.

    While every attempt has been made to catch all runtime errors. There are always a few that may slip through the crackyou encounter any unhandled errors please make a note of the circumstances that caused the error and drop us a line www.kronosrobotics.com.

    The same goes for conversion warnings. If you notice any that don't seem to fit the settings you have placed in your cosend us a short example showing the anomaly.

    Arrays

    You can create floating point, integer and string arrays. An array is a block of the same kind of variable that can beaccessed with an index. This effectively allows you to cycle through a list of variables. Both single dimension Z(x) anddouble dimension arrays are supported Z(x,y)

    Integer Arrays

    Creating an integer array works just line creating normal integers. You simply need to add a bit more information so wecan tell the compiler how many we want to define.

    dim myvarb(10) as integer

    Will create a block of 10 32-bit integer variables. You can access each individual element by using the index. Note thatfirst array element is 0 so in this case we will use 0-9 to represent the elements.

    myvarb(0) = 5000 'The first element in the arraymyvarb(9) = 400 'The last element in the array

    http://www.krmicros.com/http://www.kronosrobotics.com/http://www.kronosrobotics.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    14/177

    Language Overview

    Zeus www.krmicros.comPage 14

    Floating Point Arrays

    Float arrays work just like integer arrays. The only difference is that we will use the float declaration instead of integer.

    dim myvarb(10) as float

    This will create a block of 10 floating point variables. Again you can access each element by using an index.

    myvarb(0)= 2.76 '1st elementmyvarb(2)=300.54 '3 rd element

    String Arrays

    As with integer and floating point arrays you may create string arrays.

    dim mystring(10) as string

    This will create 10 strings that you can access via an index number.

    Array exceptions and rules

    You can use arrays in any expression. Automatic conversion will take place between each type.

    You can not pass the whole array to a function. Only a single element can be passed. You can use global variable arraysto manipulate array data in different functions

    You can not return whole arrays with the exit command. You can only return a single element.

    When a command requires a variable for data return you my not use an array.

    You can not access individual bits and bytes of array elements. For example myvarb(1).bit(7) is not currently allowed..

    There is no bounds checking on arrays so if you index outside the allocated block you will access data in other variables.

    _ Continuation Operator

    This character can be placed at the end of a line. This tells the compiler that the current line continues to the next line.This is useful when doing tables as well as lookup and lookdown commands. The continuation operator can not becontained in quotes.

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    15/177

    Command Synt

    Zeus www.krmicros.com Page

    In the following section the actual syntax of each command will be shown. Each command name will be followed by asyntax example and a syntax parameter type. Commands may be upper, lower or mixed case.

    Some commands can be used as standalone or in expressions. When used in expression the command may take on different action and it will be noted in the explanation.

    The paramater types will be indicated as follows:

    exp:Any variable type, literal mathematical expression. The parameter is expected to be numberic as a floating poior integer. If a string is passed it will be converted to a numberic before being added to the expression. A Iexp orFmay also be used to indicate that the type of numeric data prefered.

    Sexp: This is a string expression. The parameter is expected to be a string . If numeric data is passed it will beconverted to a string before being addded to the expresion. So 5+5 in a string expression will be 55 not 10.

    varb: Variable accepted only. No arrays, bit or byte extensions. The command may also specify the type of variableusing Fvarb, Ivarb or Svarb.

    label: Valid location label.

    number: Can contain only a number or constant.

    operator: Valid operator as in > < >=

  • 7/29/2019 manuale Zeus

    16/177

    Command Table of Contents

    Zeus www.krmicros.comPage 16

    Abs() . . . . . . . . . . . . . . . . . . . . .84Acos() . . . . . . . . . . . . . . . . . . . .84AppInfo() . . . . . . . . . . . . . . . . . .121Args() . . . . . . . . . . . . . . . . . . . . .121

    Asc() . . . . . . . . . . . . . . . . . . . . .42Asin() . . . . . . . . . . . . . . . . . . . . .84Atan() . . . . . . . . . . . . . . . . . . . . .84Atan2() . . . . . . . . . . . . . . . . . . . .85BeginsWith() . . . . . . . . . . . . . . .110BitGet() . . . . . . . . . . . . . . . . . . .18BitMapDrawBitmap() . . . . . . . . .70BitMapDrawFillPoly() . . . . . . . . .70BitMapDrawPoly() . . . . . . . . . . .70BitMapDrawText() . . . . . . . . . . .71BitMapEllipse() . . . . . . . . . . . . .71BitMapFillEllipse() . . . . . . . . . . .71BitMapFillRectangle() . . . . . . . .72

    BitMapLine() . . . . . . . . . . . . . . .72BitMapRectangle() . . . . . . . . . . .72BitSet() . . . . . . . . . . . . . . . . . . .18Break() . . . . . . . . . . . . . . . . . . . .18CalcRPN() . . . . . . . . . . . . . . . . .18Case . . . . . . . . . . . . . . . . . . . . .19CaseElse . . . . . . . . . . . . . . . . . .19Ceiling() . . . . . . . . . . . . . . . . . . .85Chr() . . . . . . . . . . . . . . . . . . . . .42Cint() . . . . . . . . . . . . . . . . . . . . .43ClearAll() . . . . . . . . . . . . . . . . . .19ClearGlobal() . . . . . . . . . . . . . . .20ClearLocal() . . . . . . . . . . . . . . . .20

    Clipget() . . . . . . . . . . . . . . . . . . .20Clipset() . . . . . . . . . . . . . . . . . . .20ColorBox() . . . . . . . . . . . . . . . . .121ComBGSuspend() . . . . . . . . . . .101ComBreak() . . . . . . . . . . . . . . . .96ComBuff() . . . . . . . . . . . . . . . . .92ComClose() . . . . . . . . . . . . . . . .92ComCTS() . . . . . . . . . . . . . . . . .92ComDSR() . . . . . . . . . . . . . . . . .92ComDTR() . . . . . . . . . . . . . . . . .93ComErrors() . . . . . . . . . . . . . . . .96ComGetByte() . . . . . . . . . . . . . .93ComGetIDPacket() . . . . . . . . . .95ComGetPacket() . . . . . . . . . . . .93ComGetVPacket() . . . . . . . . . . .94ComInput() . . . . . . . . . . . . . . . .96ComOpen() . . . . . . . . . . . . . . . .97ComOutput() . . . . . . . . . . . . . . .98ComPurge() . . . . . . . . . . . . . . . .98ComRTS() . . . . . . . . . . . . . . . . .99

    ComSendnWaitByte() . . . . . . . .99ComSendnWaitWord() . . . . . . .99ComSettings() . . . . . . . . . . . . . .100ComStatus() . . . . . . . . . . . . . . .101

    ComWaitForByte() . . . . . . . . . . .102ComWaitForWord() . . . . . . . . . .102Console() . . . . . . . . . . . . . . . . . .20ConsoleCls() . . . . . . . . . . . . . . .21Convert() . . . . . . . . . . . . . . . . . .110Cos() . . . . . . . . . . . . . . . . . . . . .85Cosh() . . . . . . . . . . . . . . . . . . . .86Csng() . . . . . . . . . . . . . . . . . . . .42Cstr() . . . . . . . . . . . . . . . . . . . . .42Cursor() . . . . . . . . . . . . . . . . . . .21Dec() . . . . . . . . . . . . . . . . . . . . .86Dec() . . . . . . . . . . . . . . . . . . . . .86Dim . . . . . . . . . . . . . . . . . . . . . .21

    DoEvents() . . . . . . . . . . . . . . . .22End . . . . . . . . . . . . . . . . . . . . . .22Endfunc . . . . . . . . . . . . . . . . . . .22EndSelect . . . . . . . . . . . . . . . . .23EndsWith() . . . . . . . . . . . . . . . . .110Exit() . . . . . . . . . . . . . . . . . . . . .22Exp() . . . . . . . . . . . . . . . . . . . . .86FileClose() . . . . . . . . . . . . . . . . .44FileCopy() . . . . . . . . . . . . . . . . .44FileDelete() . . . . . . . . . . . . . . . .45FileDialog() . . . . . . . . . . . . . . . .44FileEOF() . . . . . . . . . . . . . . . . . .45FileFolderChange . . . . . . . . . . .45

    FileFolderCreate . . . . . . . . . . . .45FileFolderCurrent . . . . . . . . . . .46FileFolderDelete . . . . . . . . . . . .46FileFolderInfo . . . . . . . . . . . . . .46FileInfo() . . . . . . . . . . . . . . . . . .47FileLoadResource() . . . . . . . . . .122FileMove() . . . . . . . . . . . . . . . . .48FileOpen() . . . . . . . . . . . . . . . . .48FilePeek() . . . . . . . . . . . . . . . . .48FilePos() . . . . . . . . . . . . . . . . . .49FileQuickAdd() . . . . . . . . . . . . . .52FileQuickLoad() . . . . . . . . . . . . .52FileQuickLoadAll() . . . . . . . . . . .52FileQuickSave() . . . . . . . . . . . . .53FileQuickSaveAll() . . . . . . . . . . .53FileRead() . . . . . . . . . . . . . . . . .49FileReadFile() . . . . . . . . . . . . . .49FileReadLine() . . . . . . . . . . . . . .50FileSeek() . . . . . . . . . . . . . . . . .50FileWrite() . . . . . . . . . . . . . . . . .50

    FileWriteFile() . . . . . . . . . . . . . .51FileWriteLine() . . . . . . . . . . . . . .51Fix() . . . . . . . . . . . . . . . . . . . . . .87Float() . . . . . . . . . . . . . . . . . . . .43

    Floor() . . . . . . . . . . . . . . . . . . . .87For/Next . . . . . . . . . . . . . . . . . . .23FormAddPoint() . . . . . . . . . . . . .54FormAllButtons() . . . . . . . . . . . .57Format() . . . . . . . . . . . . . . . . . . .111FormBGColor() . . . . . . . . . . . . .54FormBitmapColor() . . . . . . . . . .54FormBitmapColorClear() . . . . . .54FormBitmapFill() . . . . . . . . . . . .73FormBitmapSave() . . . . . . . . . .55FormBitmapSource() . . . . . . . . .55FormBitmapTarget() . . . . . . . . .55FormBrush() . . . . . . . . . . . . . . .56

    FormButton() . . . . . . . . . . . . . . .57FormButton() . . . . . . . . . . . . . . .56FormCls() . . . . . . . . . . . . . . . . .58FormCreateBitmap() . . . . . . . . .73FormCreateBitmap() . . . . . . . . .73FormCreatePoly() . . . . . . . . . . .57FormCurMouseX() . . . . . . . . . . .58FormCurMouseY() . . . . . . . . . . .58FormDrawBitmap() . . . . . . . . . .58FormDrawFillPoly() . . . . . . . . . .59FormDrawPoly() . . . . . . . . . . . .59FormDrawText() . . . . . . . . . . . . .59FormEllipse() . . . . . . . . . . . . . . .60

    FormFillEllipse() . . . . . . . . . . . .60FormFillRectangle() . . . . . . . . . .66FormFont() . . . . . . . . . . . . . . . .60FormLabel() . . . . . . . . . . . . . . . .61FormLine() . . . . . . . . . . . . . . . . .61FormLoadBitmap() . . . . . . . . . .62FormLoadBitmapResource() . . .123FormLoadBitmapResource() . . .122FormMenu() . . . . . . . . . . . . . . . .62FormMenu() . . . . . . . . . . . . . . . .62FormMouseDown() . . . . . . . . . .63FormMouseMove() . . . . . . . . . .63FormMouseUp() . . . . . . . . . . . .63FormMouseX() . . . . . . . . . . . . .63FormMouseY() . . . . . . . . . . . . .63FormNew() . . . . . . . . . . . . . . . .64FormPen() . . . . . . . . . . . . . . . . .64FormPolyBrush() . . . . . . . . . . . .64FormPolyPen() . . . . . . . . . . . . .64FormPos() . . . . . . . . . . . . . . . . .65

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    17/177

    Command Table of Conten

    Zeus www.krmicros.com Page

    FormPosition() . . . . . . . . . . . . . .65FormPrint() . . . . . . . . . . . . . . . .65FormRectangle() . . . . . . . . . . . .66FormRes() . . . . . . . . . . . . . . . . .66FormResolution() . . . . . . . . . . . .66FormSettings() . . . . . . . . . . . . . .67FormTextBox() . . . . . . . . . . . . . .68FormTextBox() . . . . . . . . . . . . . .67FormTextBoxSelection() . . . . . .68FormTextColor() . . . . . . . . . . . .68FormTextHeight() . . . . . . . . . . . .69FormTextWidth() . . . . . . . . . . . .69FormUpdate() . . . . . . . . . . . . . .68FormUpdateAutoOff() . . . . . . . .69FormUpdateAutoOn() . . . . . . . .69FromFloat . . . . . . . . . . . . . . . . .23Func . . . . . . . . . . . . . . . . . . . . .24

    Fuzzy() . . . . . . . . . . . . . . . . . . .123GetArgs() . . . . . . . . . . . . . . . . . .25GetArgsFloat() . . . . . . . . . . . . . .25GetArgsInt() . . . . . . . . . . . . . . . .25GetArgsString() . . . . . . . . . . . . .25GetDate() . . . . . . . . . . . . . . . . . .26Getms() . . . . . . . . . . . . . . . . . . .27GetOwner() . . . . . . . . . . . . . . . .26GetTime() . . . . . . . . . . . . . . . . .27GetWord() . . . . . . . . . . . . . . . . .115Global . . . . . . . . . . . . . . . . . . . .27Gosub . . . . . . . . . . . . . . . . . . . .28Goto . . . . . . . . . . . . . . . . . . . . . .28

    GPSAltitude() . . . . . . . . . . . . . .74GPSCalcDist() . . . . . . . . . . . . . .74GPSCourse() . . . . . . . . . . . . . . .74GPSCVTLatitudeDec() . . . . . . .75GPSCVTLongitudeDec() . . . . . .75GPSDate() . . . . . . . . . . . . . . . . .76GPSDone() . . . . . . . . . . . . . . . .77GPSLatitude() . . . . . . . . . . . . . .77GPSLatitudeDec() . . . . . . . . . . .77GPSLatitudeHem() . . . . . . . . . .77GPSLoad() . . . . . . . . . . . . . . . .78GPSLongitude() . . . . . . . . . . . . .78GPSLongitudeDec() . . . . . . . . .78GPSLongitudeHem() . . . . . . . . .78GPSSatellites() . . . . . . . . . . . . .78GPSSpeed() . . . . . . . . . . . . . . .79GPSTime() . . . . . . . . . . . . . . . .79GPSUDate() . . . . . . . . . . . . . . .79GPSUTime() . . . . . . . . . . . . . . .79ICaps() . . . . . . . . . . . . . . . . . . . .115

    If/Then/Else . . . . . . . . . . . . . . . .28Inc() . . . . . . . . . . . . . . . . . . . . . .87Inc() . . . . . . . . . . . . . . . . . . . . . .87Include . . . . . . . . . . . . . . . . . . . .28InputBox() . . . . . . . . . . . . . . . . .29Insert() . . . . . . . . . . . . . . . . . . . .115Instr() . . . . . . . . . . . . . . . . . . . . .116Instructions() . . . . . . . . . . . . . . .122Int() . . . . . . . . . . . . . . . . . . . . . .43KeyDown() . . . . . . . . . . . . . . . . .29KRDBAddField() . . . . . . . . . . . .80KRDBAddRecord() . . . . . . . . . .80KRDBClose() . . . . . . . . . . . . . . .80KRDBGetField() . . . . . . . . . . . .81KRDBOpen() . . . . . . . . . . . . . . .81KRDBReadRecord() . . . . . . . . .81KRDBRecords() . . . . . . . . . . . . .82

    KRDBResetFields . . . . . . . . . . .82KRDBSetField() . . . . . . . . . . . . .82KRDBStringMode . . . . . . . . . . .83KRDBWriteRecord() . . . . . . . . .83Left() . . . . . . . . . . . . . . . . . . . . .116Len() . . . . . . . . . . . . . . . . . . . . .116Log() . . . . . . . . . . . . . . . . . . . . .87Log10() . . . . . . . . . . . . . . . . . . .88LookDown() . . . . . . . . . . . . . . . .29LookUp() . . . . . . . . . . . . . . . . . .29Lower() . . . . . . . . . . . . . . . . . . .116Max() . . . . . . . . . . . . . . . . . . . . .88Mid() . . . . . . . . . . . . . . . . . . . . .117

    Min() . . . . . . . . . . . . . . . . . . . . .88MsgBox() . . . . . . . . . . . . . . . . . .30Nop() . . . . . . . . . . . . . . . . . . . . .30OnGosub . . . . . . . . . . . . . . . . . .31OnGoto . . . . . . . . . . . . . . . . . . .31Overlay() . . . . . . . . . . . . . . . . . .117ParseValue() . . . . . . . . . . . . . . .117Pause() . . . . . . . . . . . . . . . . . . .31Platform() . . . . . . . . . . . . . . . . . .31PlaySound() . . . . . . . . . . . . . . . .32Pow() . . . . . . . . . . . . . . . . . . . . .88Print . . . . . . . . . . . . . . . . . . . . .32Priority() . . . . . . . . . . . . . . . . . . .32Random() . . . . . . . . . . . . . . . . .89ReadBit() . . . . . . . . . . . . . . . . . .32RegCreateKey() . . . . . . . . . . . .33RegDeleteKey() . . . . . . . . . . . . .33RegDeleteValue() . . . . . . . . . . .34RegGetValue() . . . . . . . . . . . . . .34RegSetValue() . . . . . . . . . . . . . .35

    Replace() . . . . . . . . . . . . . . . . . .11Return . . . . . . . . . . . . . . . . . . . .35Right() . . . . . . . . . . . . . . . . . . . .11Round() . . . . . . . . . . . . . . . . . . .89

    RunApp() . . . . . . . . . . . . . . . . . .35Select Case . . . . . . . . . . . . . . . .36Select Float . . . . . . . . . . . . . . . .36Select Integer . . . . . . . . . . . . . .36Select String . . . . . . . . . . . . . . .36Set . . . . . . . . . . . . . . . . . . . . . . .36SetDate() . . . . . . . . . . . . . . . . . .37SetTime() . . . . . . . . . . . . . . . . . .37Sin() . . . . . . . . . . . . . . . . . . . . . .89Sinh() . . . . . . . . . . . . . . . . . . . . .89Sleep() . . . . . . . . . . . . . . . . . . . .37SocketBuffer() . . . . . . . . . . . . . .10SocketClearError() . . . . . . . . . .10

    SocketClose() . . . . . . . . . . . . . .10SocketConnect() . . . . . . . . . . . .10SocketData() . . . . . . . . . . . . . . .10SocketError() . . . . . . . . . . . . . . .10SocketInput() . . . . . . . . . . . . . . .10SocketListen() . . . . . . . . . . . . . .10SocketOutput() . . . . . . . . . . . . .10SocketQuickCheck() . . . . . . . . .10SocketState() . . . . . . . . . . . . . . .108Sqrt() . . . . . . . . . . . . . . . . . . . . .90StrIf/Then/Else . . . . . . . . . . . . . .38StrLookDown() . . . . . . . . . . . . .38StrLookUp() . . . . . . . . . . . . . . . .38

    Tan() . . . . . . . . . . . . . . . . . . . . .90Tanh() . . . . . . . . . . . . . . . . . . . .90Timer() . . . . . . . . . . . . . . . . . . . .39TimerClear() . . . . . . . . . . . . . . .39ToFloat . . . . . . . . . . . . . . . . . . . .39Trim() . . . . . . . . . . . . . . . . . . . . .11TrimEnd() . . . . . . . . . . . . . . . . .11TrimStart() . . . . . . . . . . . . . . . . .11Upper() . . . . . . . . . . . . . . . . . . .11val() . . . . . . . . . . . . . . . . . . . . . .43Version() . . . . . . . . . . . . . . . . . .40Wild() . . . . . . . . . . . . . . . . . . . . .12WriteBit() . . . . . . . . . . . . . . . . . .41

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    18/177

    BitGet

    Zeus www.krmicros.comPage 18

    Base Commands

    BitGet()

    BitGet(Value,Bit)BitGet(Iexp,Iexp) Integer

    DescriptionReturns the state of a bit from a given value. Will return 1 or 0.

    Value - This integer expression to test. Bit - The bit to test. Only bits 0-23 may be tested.

    BitSet()

    BitSet(Value,Bit,Value)BitSet(Iexp,Iexp,Iexp) Integer

    DescriptionReturns the final result of setting or resetting a bit. If you want to change the

    bit of a variable use it in a expression such as Myvarb=BitSet(Myvarb,13,1)

    Value - The regional value. IE the variable or expression. Bit - The bit to change. Only bits 0-23 may be changed. Value - If 0 will set the given bit to 0. Any thing else sets it to 1.

    Break()

    Break()Break()

    Description

    This command stops execution and places the program in single step mode.Only valid when used with Edit Environment. On Console targets will pausethe program.

    CalcRPN()

    CalcRPN(Name,RPN)CalcRPN(Sexp,Sexp) String

    Description

    This command will generate and return a registry key based on a Name

    and RPN string. This command is compatible with Handango andPocket Gear.

    Name - This is the name string to work against with the RPN string.Normally it is the Owner Name.

    RPN - This is the RPN string to calculate against the name.

    Typical RPN Formulas

    "i 0 == 111 % key + c 12 * +"

    Zp Pz

    Zp Pz

    Allfunc main()

    dim x as integerdim value as integer

    value = 255

    for x = 30 to 0 step -1print bitget(value,x);next

    print

    endfunc

    func main()

    dim x as integerdim bit as integer

    for bit = 0 to 30x = 0

    bitset(x,bit,1)print bit,xnext

    endfunc

    func main()

    dim treg as stringtreg = CalcRPN("Michael Simpson","i 0 == 111 * key + c 2 * +")print treg

    endfunc

    ZW5 ZC5 ZC ZCLCE

    All

    ZW5 ZC5

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    19/177

    ClearA

    Zeus www.krmicros.com Page

    Base Commands

    "i 0 == 210 - key + c 2 * 4 / +"

    "i 0 == c + 5 - key + c 77 * +"Currently the following operators are supportedLogical: ==, !=, =, >, 0 thenexit("Hello "+name)else

    exit("Who are you.")endif

    endfunc

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    26/177

    GetOwner

    Zeus www.krmicros.comPage 26

    Base Commands

    GetOwner()

    GetOwner()GetOwner) String

    DescriptionReturns the Pocket PC Owner Name.

    GetDate()

    GetDate(Format)Getms(iexp) String

    DescriptionReturns the current date in various formats.

    Format - An integer that indicates to format to return.

    0 = YYYY-M-D1 = YYYY-MM-DD2 = MM/DD/YY3 = MM/DD/YYYY4 = Year (Numeric Value)5 = Month (Numeric Value)6 = Day (Numeric Value)7 = DayofWeek (Text Value)8 = DayofYear (Numeric Value)

    Any other value will return current Date and Time in Systems format

    Pz

    Zp Pz

    func main()

    print "Owner = "+GetOwner()

    endfunc

    func main()

    print GetDate(9)

    endfunc

    ZlZW5 ZC5

    ZW5 ZC5

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    27/177

    Glob

    Zeus www.krmicros.com Page

    Base Commands

    Getms()

    Getms()Getms() Integer

    DescriptionReturns the number of milliseconds that have elapsed since the program hstarted.

    GetTime()

    GetTime(Format)GetTime(iexp) String

    DescriptionReturns the current time in various formats.

    Format - An integer that indicates to format to return.

    -1 = Returns system now.ticks as a string-2 = Returns system now.ticks as a string and resets getms()0 = H:M:S1 = HH:MM:SS2 = UTC Format3 = Number of Seconds since midnight4 = Hour (Numeric Value)5 = Minute (Numeric Value)6 = Second (Numeric Value)7 = Milliseconds (Numeric Value)

    Any other value will return current Time in Systems format

    Global

    Global Varb as TypeGlobal Variable as [string][integer][single]

    DescriptionCreates a global variable that will exist for all functions. Global variables

    are not initilized so you need to set them.

    Note that you can define multiple integers as in:

    Global x,y,z

    You can not do this for strings or singles.

    Varb - The name of the variable you wish to create. Must begin with acharacter.

    Type - The type of variable you wish to create. Must be integer, singlestring. If no type is provided the variable will be created as an integer.

    Zp

    func main()

    print GetTime(1)

    endfunc

    func main()

    dim x as integer

    loop:x=getms()print x

    pause(1000)consoleCLS()

    goto loop

    endfunc

    func main()

    Global X as stringX = "Mike"

    testfunc()print X

    endfunc

    func testfunc()X = "Fred"

    endfunc

    ZW5 ZC5

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    28/177

    Gosub

    Zeus www.krmicros.comPage 28

    Base Commands

    Gosub

    Gosub LabelGosub Label

    DescriptionMakes a call to a subroutine within the current function. Calling subroutinesinside the function is several times faster than calling a user function and usesless memory. You return from the subroutine using the Return command.

    Label - The label to call

    Goto

    Goto LabelGoto Label

    Description

    Jumps to a location in the program with in the current function.

    Label - The label to jump to.

    f/Then/Else

    If OPER1 = Oper2 Thenif exp = exp then

    DescriptionWill compare two numeric expressions. If the compare is true all codebetween the then and Endif or Else is executed. You may also use the and/or

    operators to compare more than one expression.

    Important: If you want to compare strings values you need to use the StrIfcommand. The If command always converts the string to integers first.You may not mix string and numeric operations using and and and oroperators.

    OPER1 - A numeric operation to compare OPER2 - A numeric operation to compare

    nclude

    Include FileNameInclude Literal Text

    DescriptionIncludes a file as part of the program to run. All include files is read justbefore the engine is started to create one large continuous virtual file. Thisallows you to break your code up into useable functions or libraries.

    FileName - The name of the file to load.

    func main()dim X as String

    X = "Mike" : Gosub printdatX = "Fred" : Gosub printdatX = "Jhon" : Gosub printdat

    End

    printdat:print XReturn

    endfunc

    func main()dim X as IntegerX = 1

    Loop:Print XPause(100)

    X = X + 1Goto Loop

    endfunc

    func main()Dim x as integer

    For x = 1 to 1000print xif x = 10 then

    endendif

    Next

    endfunc

    func main()

    ZPInitInterface(1,1)

    endfunc

    include "+Lib\ZPServo1.Lib"

    All

    All

    All

    All

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    29/177

    LookDow

    Zeus www.krmicros.com Page

    Base Commands

    InputBox()

    InputBox(Prompt, [Title], [Default Value])InputBox(Sexp,[Sexp],[Sexp]) string

    DescriptionThis function will popup a box and prompt the user for a string of data.

    Prompt - The prompt text displayed to the user. Title - An optional value that will be displayed in the title. Default Value - The default text that will be placed in the input field.

    KeyDown()

    KeyDown(KeyCode)KeyDown(exp) integer

    DescriptionReturns a 1 of the key is currently down. Returns a 0 if not. This function

    also be used to determine mouse and stylus events as well.

    KeyCode - The code of the key you wish to test. 0-255.

    Note there is a sample program included called KeyScan.txt which can beused to determine the key codes.

    LookDown()

    LookDown(FailValue,SearchValue,Value0,Value1,Value2)LookDown(exp,exp,exp,exp,exp) integer

    DescriptionSearch a list of values then return an index to that value. This function is zbased and will return FailValue if it can not find the SearchValue.

    FailValue - The value to return if the Search value is not located in anythe Values given.

    SearchValue - The Value used to search for. Value0-ValueN - The values to search against.

    LookUp()

    LookUp(FailValue,Index,Value0,Value1,Value2)

    LookUp(exp,exp,exp,exp,exp) integer

    DescriptionReturn a value based on an Index. This is 0 based.

    FailValue - The value to return if the Index is less then 0 or greater thethe number of items.

    Index - The value used to index and retrieve the value list. Value0-ValueN - The value to return based on the Index. If the index

    then Value0 is returned. If the index is 1 then Value1 and so on.

    Zp

    func main()

    dim svarb as string

    svarb = inputbox("Enter Name","Title","pig",10,10,21)

    print "Hello "+svarb

    endfunc

    func main()

    Loop:ifKeyDown(37) =1 then

    print "Left Arrow"endif

    ifKeyDown(38) =1 thenprint "Up Arrow"

    endififKeyDown(39) =1 then

    print "Right Arrow"endififKeyDown(40) =1 then

    print "Down Arrow"endifgoto Loop

    endfunc

    func main()

    dim x as integer

    x=lookdown(1000,90,10,20,30,40,50,60,70,80,90)

    print x

    endfunc

    ZW5 ZC5

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    30/177

    MsgBox

    Zeus www.krmicros.comPage 30

    Base Commands

    MsgBox()

    MsgBox(Prompt,Buttons,[Title])MsgBox(Sexp,Iexp,[Sexp]) integer

    DescriptionThis function will popup a message box. You can set the button types bysetting the Buttons argument. The function will return a integer representingthe button hit. This command can be used in a expression or standalone.

    Prompt - The prompt text displayed to the user. Buttons - An integer representing the types of buttons to display.

    0 Displays OK button only.1 Displays OK and Cancel buttons.2 Displays Abort, Retry, and Ignore buttons.3 Displays Yes, No, and Cancel buttons.4 Displays Yes and No buttons.5 Displays Retry and Cancel buttons.

    16 Displays Critical Message icon.32 Displays Warning Query icon.48 Displays Warning Message icon.64 Displays Information Message icon.0 First button is default.256 Second button is default.512 Third button is default.

    Title - An optional value that will be displayed in the title.

    Returns the following depending on which button is hit.

    OK 1

    Cancel 2Abort 3Retry 4Ignore 5Yes 6No 7

    Nop()

    Nop()Nop()

    DescriptionThis command does nothing. It is provided to aid in debugging during thesingle step process. It can also be used to create very small delays in themicroseconds.

    func main()

    dim ivarb as integer

    ivarb = msgbox("!!!! Warning !!!!",16,"Ooops")

    print "Result="+ivarb

    endfunc

    All

    All

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    31/177

    Platfor

    Zeus www.krmicros.com Page

    Base Commands

    OnGosub

    OnGosub Index ,Label0,Label1,...OnGosub Iexp,Label,Label,...

    DescriptionCall a subroutine based on an index. Index is zero based. The returncommand will return to the next command following this command.

    Index - A value used to calculate the label to locate for the jump. Label0-LableN - The labels for possible jumps.

    OnGoto

    OnGoto Index ,Label0,Label1,...OnGoto Iexp,Label,Label,...

    Description

    Jump to a label based on an index. Index is zero based.

    Index - A value used to calculate the label to locate for the jump. Label0-LableN - The labels for possible jumps.

    Pause()

    Pause(ms)Pause(Iexp)

    DescriptionCause Zeus to wait for the number of milliseconds indicated. Note that Ze

    will process events and allow outside process to run during the wait.

    ms - The number of milliseconds to wait.

    Platform()

    Platform()Platform() integer

    DescriptionReturns a number indicating the current platform.

    1 - Desktop Compiled Application2 - Desktop Development3 - Pocket PC Compiled Application4 - Pocket PC Development

    Zp

    func main()

    dim x as integer

    print "Platform = "+Platform()

    for x = -2 to 4

    print x;" ";ongosub x,do0,do1,do2pause(500)next

    end

    do0:print "do0"return

    do1:print "do1"return

    do2:print "do2"return

    endfunc

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    32/177

    PlaySound

    Zeus www.krmicros.comPage 32

    Base Commands

    PlaySound()

    PlaySound(File)PlaySound(Sexp)

    DescriptionPlays a wave file located in the Zeus directory.

    File - The file to play. This must be a wave file. If you begin with a . thenthe current Zeus directory will be used for the file.

    Print

    Print Value1,Value2Print Sexp,Sexp or Print Sexp;Sexp

    DescriptionPrints data to the console. Data separated by commas will be separated with

    a tab. Those with a semicolon will be placed right next to one another.

    Note that any type of expression can be used but all will be converted tostrings before printing.

    Priority()

    Priority(Cycles)Priority(Iexp)

    DescriptionThis command allows you change the amount of time slices the Zeus enginegets over the rest of the operating system. The default is a setting of 25. The

    value can be between 1 and 1000. With 1000 the highest priority going to theZeus engine

    Cycles - The number of engine cycles to run before freeing a time slice toan outside process.

    Note that unless you are running on a slow machine or have several threadsrunning this command will have little effect.

    ReadBit()

    ReadBit(Array,Bit)ReadBit(ArrayName,exp) integer

    DescriptionReturns the value 0 or 1 of a bit across an integer array. Note that only thelower 8bits are used in each array element.

    Array - The name of the array to read a bit from. Bit - The bit across the array to access

    Zp Pz PzLfunc main()

    'Play Built-in Default Sound (beep)playsound("xx")

    endfunc

    func main()Priority(1)

    Loop:nopgoto Loop

    endfunc

    func main()

    dim ivarb as integer

    ivarb = msgbox("!!!! Warning !!!!",16,"Ooops")

    print "Result="+ivarb

    endfunc

    Zl

    Zp PzZW5 ZC5 ZC ZCLCE

    All

    All

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    33/177

    RegDeleteK

    Zeus www.krmicros.com Page

    Base Commands

    RegCreateKey()

    RegCreateKey(Type,KeyName)RegCreateKey(exp,Sexp) integer

    DescriptionCreates a registry Key. The command can be called standalone or as avalue. Will return 1 if success and 0 if failure.

    Type - Sets the registry tree

    0 = HKEY_CLASSES_ROOT1 = HKEY_CURRENT_USER2 = HKEY_LOCAL_MACHINE3 = HKEY_USERS

    KeyName - The name of the key to create.

    RegDeleteKey()

    RegDeleteKey(Type,KeyName)RegDeleteKey(exp,Sexp) integer

    DescriptionDeletes a registry Key. The command can be called standalone or as avalue. Will return 1 if success and 0 if failure.

    Type - Sets the registry tree

    0 = HKEY_CLASSES_ROOT1 = HKEY_CURRENT_USER2 = HKEY_LOCAL_MACHINE3 = HKEY_USERS

    KeyName - The name of the key to delete

    Zp

    func main()

    dim x as stringx = RegCreateKey(1,"Software\KRMicros\RegTest")print "Create Status = ",x

    x = RegSetValue(1,"Software\KRMicros\RegTest","Name","Fred")print "Set Status = ",x

    x = RegGetValue(1,"Software\KRMicros\RegTest","name")print "Get Value= ",x

    x = RegDeleteKey(1,"Software\KRMicros\RegTest")print "Delete Status = ",x

    endfunc

    Zp

    ZW5 ZC5

    ZW5 ZC5

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    34/177

    RegDeleteValue

    Zeus www.krmicros.comPage 34

    Base Commands

    RegDeleteValue()

    RegDeleteValue(Type,KeyName,ValueName)RegDeleteValue(exp,Sexp,Sexp) integer

    DescriptionDeletes a registry Key value. The command can be called standalone or as avalue. Will return 1 if success and 0 if failure.

    Type - Sets the registry tree

    0 = HKEY_CLASSES_ROOT1 = HKEY_CURRENT_USER2 = HKEY_LOCAL_MACHINE3 = HKEY_USERS

    KeyName - The name of the key to delete ValueName - The name of the Value to delete

    RegGetValue()

    RegGetValue(Type,KeyName,ValueName)RegGetValue(exp,Sexp,Sexp) integer

    DescriptionReturns a registry Key value. The command can be called standaloneor as a value.

    Type - Sets the registry tree

    0 = HKEY_CLASSES_ROOT1 = HKEY_CURRENT_USER2 = HKEY_LOCAL_MACHINE3 = HKEY_USERS

    KeyName - The name of the key to delete ValueName - The name of the Value to delete

    Zp Pz

    Zp Pz

    func main()

    dim x as stringx = RegCreateKey(1,"Software\KRMicros\RegTest")print "Create Status = ",x

    x = RegSetValue(1,"Software\KRMicros\RegTest","Name","Fred")print "Set Status = ",x

    x = RegGetValue(1,"Software\KRMicros\RegTest","name")print "Get Value= ",x

    x = RegDeleteKey(1,"Software\KRMicros\RegTest")

    print "Delete Status = ",x

    endfunc

    ZW5 ZC5

    ZW5 ZC5

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    35/177

    RunAp

    Zeus www.krmicros.com Page

    Base Commands

    RegSetValue()

    RegSetValue(Type,KeyName,ValueName,Value)RegSetValuee(exp,Sexp,Sexp,exp) integer

    DescriptionSets a registry Key value. The command can be called standalone or as avalue. Will return 1 if success and 0 if failure.

    Type - Sets the registry tree

    0 = HKEY_CLASSES_ROOT1 = HKEY_CURRENT_USER2 = HKEY_LOCAL_MACHINE3 = HKEY_USERS

    KeyName - The name of the key to delete ValueName - The name of the Value to delete Value - The value to write.

    Return

    ReturnReturn

    DescriptionThis command returns from a gosub call. Note that returning without a gowill cause stack errors.

    RunApp()

    RunApp(Application,Arguments)RunApp(Sexp,Sexp)

    DescriptionThis command will let you start another application.

    Application - The path and name of the application to run. You may uthe + and . to add the source or application path to the expression.

    Arguments - The arguments you want to add. If you don't want anyarguments you must use an empty string. Here you may also add theapplication or source path but because you may also pass non file

    arguments you have to preface the + or . with a ~. The ~. and ~+ are valid on the first argument.

    Zp

    Zp

    func main()dim X as String

    X = "Mike" : Gosub printdatX = "Fred" : Gosub printdatX = "Jhon" : Gosub printdat

    End

    printdat:print XReturn

    endfunc

    func main()

    RunApp(".RunApp.txt","")endfunc

    ZW5 ZC5

    ZW5 ZC5

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    36/177

    Select Case

    Zeus www.krmicros.comPage 36

    Base Commands

    Select Case

    Select Case valueSelect Case exp

    Select Integer

    Select Integer valueSelect Integer exp

    Select Float

    Select Float valueSelect Float exp

    Select String

    Select String valueSelect String exp

    DescriptionThe Select command is a multi part command. You start the command with aSelect and Selection type. IE Select Integer. If you use the Select Case itdefaults to a Selection type of string that will work with all values. If you areusing Integers then a Select Integer will run much faster than the other types.You need to also keep this in mind if you are going to use math in theexpression.

    Value - This is a expression that will represent the value that we will try tomatch up with a Case command. Again note that the default type of stringuses string math when calculating this expression. It may be necessary touse a Int() or Float() function to encapsulate your math. You can alwaysuse the raw Select Integer or Select Float for better and faster numbercomparisons.

    Set

    Set Varb = x,y,z,....Set Variable = exp,exp,exp,....

    DescriptionLets you quickly load a array variable starting at its first position.

    This command works with string, integer and floating point variables.

    Varb - The name of the variable you wish to load. Note that no boundschecking is done and if you load more than the variable was defined oryou load a non array variable the next entry will be loaded into the nextdefined variable.

    x,y,z - The data to load into the variable. This expression is calculated atruntime so any valid expression will work. Even functions.

    Zp Pz

    Zp Pz

    Select Case 25

    Case 10

    print "Its 10"

    Case 25

    print "Its 25"

    CasElse

    print Unknown

    EndSelect

    Zp Pz

    Zp Pz

    dim tvarb(5) as integer

    set tvarb = 10,20,30,40,50

    Zp Pz

    ZW5 ZC5 ZC ZCLCE

    ZW5 ZC5 ZC ZCLCE

    ZW5 ZC5 ZC ZCLCE

    ZW5 ZC5 ZC ZCLCE

    ZW5 ZC5

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    37/177

    Sle

    Zeus www.krmicros.com Page

    Base Commands

    SetDate()

    SetDate(Month,Day,Year)SetDate(exp,exp,exp)

    DescriptionThis command will set the system date of your PC or Pocket PC. Note tha

    this date is expressed in Coordinated Universal Time (UTC). That is to sathat your local time in your PC or Pocket PC will automatically be calculateto the correct time and date based on the UTC you provide.

    This command works with string, integer and floating point variables.

    Month - The number of the month you wish to set. 1-12 Day - The number of the day you wish to set. 1-31 Year - The number of the year you wish to set. This is the full year. IE

    2000

    SetTime()SetTime(Hour,Minute,Second)SetTime(exp,exp,exp)

    DescriptionThis command will set the system time of your PC or Pocket PC. Note thathis date is expressed in Coordinated Universal Time (UTC). That is to sathat your local time in your PC or Pocket PC will automatically be calculateto the correct time and date based on the UTC you provide.

    This command works with string, integer and floating point variables.

    Hour - The number of the hour you wish to set. 0-24 Minute - The number of the minutes you wish to set. 0-59 Second - The number of the seconds you wish to set. 0-59

    Sleep()

    Sleep(ms)Sleep(Iexp)

    DescriptionThis command allows you to put the Zeus engine to sleep.

    ms - The number of milliseconds to sleep

    Zp

    Zp func main()

    SetTime(04,25,00)endfunc

    func main()Priority(1000)

    Loop:Sleep(1)goto Loop

    endfunc

    ZW5 ZC5

    ZW5 ZC5

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    38/177

    StrIf

    Zeus www.krmicros.comPage 38

    Base Commands

    StrIf/Then/Else

    StrIf OPER1 = Oper2 ThenStrif Sexp = Sexp then

    DescriptionWill compare two string expressions. If the compare is true all code betweenthe then and Endif or Else is executed.

    Important: The StrIf command does a string comparison not a numbercomparison therefore "01" is not the same as "1". Use the If command ifyou want to compare numeric values.

    OPER1 - A string operation to compare OPER2 - A string operation to compare

    StrLookDown()

    StrLookDown(FailValue,Mode,SearchValue,Value0,Value1,Value2)StrLookDown(exp,Iexp,exp,exp,exp,exp) integer

    DescriptionSearch a list of strings then return an index to that value. Thisfunction is zerobased and will return FailValue if it can not find the SearchValue.

    FailValue - The value to return if the Search value is notlocated in any of the Values given.

    Mode - Sets the type of compare when doing the search. SearchValue - The string to search for. Value0-ValueN - The strubgs to search against.

    Valid Modes0=Standard compare1=Case Insensitive2=Look for ValueN inside SearchValue3=Look for ValueN inside SearchValue but Case Insensitive4=Look for SearchValue inside ValueN5=Look for SearchValue inside ValueN but Case Insensitive

    StrLookUp()

    StrLookUp(FailValue,Index,Value0,Value1,...)

    StrLookUp(Sexp,Iexp,Sexp,Sexp,...) string

    DescriptionRetrieve a string based on Index. Returns FailValue if Index is out of range.

    FailValue - The string to return if the Index is less than 0 or is greater thanthe number of items.

    Index - Used to look up a particular Value. Value0-ValueN - The string to return based on the Index. If the Index is 0

    then Value 0 is returned. If its 1 then Value1 is returned and so on.

    func main()

    dim X as stringX = "Mike"StrIf X = "Mike" then

    print "Hello Mike"endif

    endfunc

    func main()

    dim x as integer

    x=strlookdown(1000,0,"Mike","Jow","Fred","Bill","Mike","Tom","Button")

    print x

    endfunc

    func main()

    dim tstr as string

    dim x as integerx = 1000

    tstr=strlookup("NoName",2,"Mike","Joe","Bill","Fred")

    print tstr

    endfunc

    All

    All

    All

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    39/177

    ToFlo

    Zeus www.krmicros.com Page

    Base Commands

    TimerClear()TimerClear(IDX)TimerClear(exp)

    DescriptionResets one of the System Timers to 0

    IDX - The number of the timer to reset (1-50)

    Timer()Timer(IDX)Timer(exp) as integer

    DescriptionReturns the current timer value in milliseconds.

    IDX - The number of the timer to reset (1-50)

    ToFloat

    ToFloat(varb1,varb2,varb3,varb4)ToFloat(exp,exp,exp,exp) as float

    DescriptionThis command takes 4 byte componets and rebuilds a float value. Use thFromFloat command to rebuild.

    varb1=varb4 - The individual byte componets used to rebuild the floatvalue.

    Zp

    Zp

    Zp

    func main()dim x as integer

    TimerClear(1)

    Loop:

    x = Timer(1)print xif x > 10000 then

    TimerClear(1)endifpause(1000)goto Loop

    endfunc

    func main()dim b1 as integerdim b2 as integerdim b3 as integerdim b4 as integer

    dim fval as floatfval = -1234.1

    print fromfloat(fval,b1,b2,b3,b4)

    printprint b1,b2,b3,b4

    print tofloat(b1,b2,b3,b4)

    endfunc

    ZW5 ZC5 ZC ZCLCE

    ZW5 ZC5 ZC ZCLCE

    ZW5 ZC5 ZC ZCLCE

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    40/177

    Version

    Zeus www.krmicros.comPage 40

    Base Commands

    Version()

    Version(Text)Version(Sexp)

    DescriptionThis command allows you to set the first 50 characters of the about box of thecompiled exe. This will allow you to display application and versioninformation. Note that two line breaks are added and all others are strippedout.

    Zp Pz func main()

    Version("Test Application V1.1")loop:

    sleep(1)goto loop

    endfunc

    ZW5 ZC5

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    41/177

    WriteB

    Zeus www.krmicros.com Page

    Base Commands

    WriteBit()

    WriteBit(Array,Bit,Value)WriteBit(ArrayName,exp,exp)

    DescriptionSets a bit in an integer array. Note that only the lower 8bits are used in eaarray element.

    Array - The name of the array to write to. Bit - The bit across the array to access Value - The value 0 or 1 to write.

    Zp ZW5 ZC5 ZC ZCLCE

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    42/177

    Asc

    Zeus www.krmicros.comPage 42

    Conversion Commands

    Asc()

    asc(Value)asc(Sexp) integer

    DescriptionReturns an Integer value representing the character code corresponding tothe first character in a string.

    Value - A String

    Chr()

    chr(Value)chr(exp) string

    DescriptionReturns the character associated with the specified character code.

    Value - An integer representing a character code. Note that only the first 8bits of this code is used.

    Csng()

    csng(Value)csng(exp) single

    DescriptionConverts any expression to a floating point.

    Value - An expression string or numeric.

    Cstr()

    cstr(Value)cstr(exp) string

    DescriptionConverts a numeric expression to a string.

    Value - A number

    Normaly this command is not needed

    func main()

    print 5.2 + 2.2print Csng(5.2 + 2.2)

    endfunc

    func main()

    print "A="+chr(65)

    endfunc

    func main()

    dim X as integer

    X = Cstr(5+2)

    print X

    endfu

    func main()

    dim X as integer

    X = Asc("A")

    print X

    endfunc

    All

    All

    All

    All

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    43/177

    V

    Zeus www.krmicros.com Page

    Conversion Commands

    Cint()

    cint(Value)cint(exp) integer

    DescriptionConverts any expression to a integer

    Value - An expression string or numeric.

    Float()

    Float(Value)Float(exp) single

    DescriptionConverts any expression to a floating point.

    Value - An expression string or numeric.

    Int()

    Int(Value)Int(exp) integer

    DescriptionConverts any expression to a integer point.

    Value - An expression string or numeric.

    val()

    val(Value)val(Sexp) integer/single

    DescriptionConverts a string expression to a number.

    Value - A string

    func main()

    print 5 + 2print int(5 + 2)

    endfunc

    func main()

    print 5.2 + 2.2print float(5.2 + 2.2)

    endfunc

    func main()

    print 5 + 2print Cint(5 + 2)

    endfunc

    func main()

    dim myStr as stringdim X as integer

    myStr = "75"

    X = Val(myStr)

    print X

    endfun

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    44/177

    FileClose

    Zeus www.krmicros.comPage 44

    File Commands

    Zeus File commands have the ability to specify the source path by beginningthe file name with a '+' , '.' or -. If the file begins with a '+' the location of theZeus application exe will be the starting path. If the file begins with a '.' thenthe location of the source code will be used. Note that once you create anexe the '+' and '.' are the same and point to the directory of the compiled exe.Note this applies when you are running that exe file. If a - is used the currentdirectory is used. The current directory can be changed with the

    FileFolderChange command.

    FileClose()

    FileClose(Channel)FileClose(number) integer

    DescriptionCloses and open file. If the file is already closed no action is taken. Returns1 if successful or 0 if file is already closed.

    Channel - The file channel to close. (1-5) This must be a number. Thiscommand can be called standalone if you don't care about the result.

    FileCopy()

    FileCopy(SourceFile,DestFile)FileClose(Sexp,Sexp) integer

    DescriptionMake a copy of a file. Returns 1 of successful and 0 if an error. Thiscommand can be used standalone if you don't care about the result.

    SourceFile - The file to copy. DestFile - The name to copy it to.

    FileDialog()

    FileDialog(Mode,Path,Title,DefFile)FileDialog(Iexp,Sexp,Sexp,Sexp) string

    DescriptionCreates a Open or Save Dialog box. Will return the full path of the selected

    or entered file or directory. Returns an empty string if cancel is hit.

    Mode - This sets the mode. 1 = Open, 2 = Save, 3 = Open withDirectory Selection, 4 = Save with Directory Selection.

    Path - The starting directory. Title - This will be the title or message to display to the user. DefFile - The startup file name.

    Note that modes 3 and 4 are only valid on the Pocket PC.

    func main()

    FileOpen(1,".filetest",Create)FileWriteLine(1,"Now is the Time")FileClose(1)

    endfunc

    func main()

    dim stat as integer

    stat = FileCopy(".FileTest.txt",".FileDup.txt")print "Copy status=",stat

    stat = FileMove(".FileDup.txt",".FileDup2.txt")print "Move status=",stat

    stat = FileDelete(".FileDup2.txt")print "Delete status=",stat

    endfunc

    func main()

    dim tfile as stringtfile = FileDialog(1,".","Select File","")print "Got File "+tfile

    endfunc

    Zp Pz

    All

    All

    ZW5 ZC5 ZC ZCLCE

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    45/177

    FileIn

    Zeus www.krmicros.com Page

    File Commands

    FileDelete()

    FileDelete(File)FileDelete(Sexp) integer

    DescriptionDelete a file. Returns 1 of successful and 0 if an error. This command canused standalone if you don't care about the result.

    File - The name of the file to delete.

    FileEOF()

    FileEOF(Channel)FileEOF(number) integer

    DescriptionReturns the EOF status of an opened file. Returns 1 if at the end of the fi

    and 0 if not.

    Channel - The file channel to test. (1-5) This must be a number.

    FileFolderChange

    FileFolderChange(Folder)FileFolderChange(Sexp) integer

    Description

    Change the applications current directory. If passed in a expression willreturn 0 if error and 1 if success.

    Folder - The path of the folder to change to.

    FileFolderCreate

    FileFolderCreate(Folder)FileFolderCreate(Sexp) integer

    DescriptionCreates a folder. If passed in a expression will return 0 if error and 1 ifsuccess.

    Folder - The path of the folder to create

    func main()

    dim stat as integer

    stat = FileCopy(".FileTest.txt",".FileDup.txt")print "Copy status=",stat

    stat = FileMove(".FileDup.txt",".FileDup2.txt")print "Move status=",stat

    stat = FileDelete(".FileDup2.txt")print "Delete status=",stat

    endfunc

    func main()

    FileOpen(1,".FileTest.txt",Open)

    Loop:ifFileEOF(1) = 0 then

    print FileRead(1)

    goto Loopendif

    FileClose(1)print "All Done"

    endfunc

    func main()

    print " Start in "+FileFolderCurrent()

    FileFolderChange("-lib")

    print " Change to "+FileFolderCurrent()

    printprint "Files located in current directory"print "--------------"print Replace(FileFolderInfo("-",21),",",chr(13)+chr(10))

    endfunc

    Zp

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    46/177

    FileFolderCurrent

    Zeus www.krmicros.comPage 46

    FileFolderCurrent

    FileFolderCurrent()FileFolderCurrent() string

    DescriptionReturns the name of the current folder. Note that when the application startsthis the application starting directory. You can change this with theFileFolderChange command.

    FileFolderDelete

    FileFolderDelete(Folder)FileFolderDelete(Sexp) integer

    DescriptionDeletes a folder. If passed in a expression will return 0 if error and 1 ifsuccess.

    Folder - The path of the folder to delete

    FileFolderInfo

    FileFolderInfo(Folder,Mode)FileFolderInfo(Sexp,Iexp) string

    DescriptionDepending on the mode returns information about a folder.

    File - The path to the file you want information on. Mode - Determines the information you wish to return.

    1 = Root Path2 = Exists Returns the string True or False3 = Parent Path4 = Full Path5 = Creation Year6 = Creation Month7 = Creation Day8 = Creation Hour9 = Creation Minute10 = Creation Second11 = Full Creation Date as String12 = Access Year

    13 = Access Month14 = Access Day15 = Access Hour16 = Access Minute17 = Access Second18 = Full Access Date as String19 = Directory Name20 = Number of files in folder21 = Returns all file names in folder separated by comma22 = Number of directories in folder23 = Returns all directory names in folder separated by comma

    Zp

    Zp Pz

    func main()

    print " Start in "+FileFolderCurrent()

    FileFolderChange("-lib")

    print " Change to "+FileFolderCurrent()

    print

    print "Files located in current directory"print "--------------"print Replace(FileFolderInfo("-",21),",",chr(13)+chr(10))

    endfunc

    Zp Pz

    ZW5 ZC5 ZC ZCLCE

    ZW5 ZC5

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    47/177

    FileIn

    Zeus www.krmicros.com Page

    FileInfo()

    FileInfo(File,Mode)FileInfo(Sexp,Iexp) string

    Description

    Depending on the mode returns information about a file.

    File - The path to the file you want information on. Mode - Determines the information you wish to return.1 = File Size2 = Exists Returns the string True or False3 = Extension4 = Directory5 = Creation Year6 = Creation Month7 = Creation Day8 = Creation Hour9 = Creation Minute

    10 = Creation Second11 = Full Creation Date as String12 = Access Year13 = Access Month14 = Access Day15 = Access Hour16 = Access Minute17 = Access Second18 = Full Access Date as String19 = File Name

    Zp Pz PZl

    print "This file 'FileInfo.txt'"print "Directory="+FileInfo(".FileInfo.txt",4)print "Size="+FileInfo(".FileInfo.txt",1)print "Created="+FileInfo(".FileInfo.txt",11)

    Displays:

    This file 'FileInfo.txt'Directory=D:\cursource\mobile\Zeus\ExamplesSize=213Created=6/7/2006 9:59:17 PM

    ZW5 ZC5

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    48/177

    FileMove

    Zeus www.krmicros.comPage 48

    File Commands

    FileMove()

    FileMove(SourceFile,DestFile)FileMove(Sexp,Sexp) integer

    DescriptionMove a file from one location to another. Returns 1 of successful and 0 if anerror. This command can be used standalone if you don't care about theresult.

    SourceFile - The file to copy. DestFile - The name and destination of the new file.

    FileOpen()

    FileOpen(Channel,File,Mode)FileOpen(number,strexp,token) Integer

    DescriptionOpens a file in various modes. Returns 1 if success and 0 if not.

    Channel - The file channel to test. (1-5) This must be a number. File - The file name to open. If you begin with a . then the current Zeus

    directory will be used for the file. Mode - The mode of operation. Open will open a file for read. Create will

    create a new file or overwrite an existing file. Append will add to the endof an existing file. You may also open the file in binary mode.BinaryOpen will open an existing file. BinaryCreate will Create a new file.When a file is opened as Binary you my perform both reading and writingon the file. This command can be called standalone if you don't care

    about the result.

    FilePeek()

    FilePeek(Channel)FilePeek(number) Integer

    Description

    Returns the next character without incrementing the filepointer. If at the end of the file a -1 is returned..

    Channel - The file channel to test. (1-5) This must bea number.

    func main()

    dim stat as integer

    stat = FileCopy(".FileTest.txt",".FileDup.txt")print "Copy status=",stat

    stat = FileMove(".FileDup.txt",".FileDup2.txt")print "Move status=",stat

    stat = FileDelete(".FileDup2.txt")print "Delete status=",stat

    endfunc

    func main()

    FileOpen(1,".filetest",Create)FileWriteLine(1,"Now is the Time")FileClose(1)

    endfunc

    func main()

    FileOpen(1,".FileTest.txt",Open)

    Loop:if FileEOF(1) = 0 then

    print "Current character is "+FileRead(1)+" The next character is "+FilePeek(1)goto Loop

    endif

    FileClose(1)print "All Done"

    endfunc

    All

    All

    All

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    49/177

    FileReadF

    Zeus www.krmicros.com Page

    File Commands

    FilePos()

    FilePos(Channel)FilePos(number) Integer

    DescriptionReturns the current file position. Only works with file that were openas binary. Returns -1 if error

    Channel - The file channel to test. (1-5) This must be a number.

    FileRead()

    FileRead(Channel)FileRead(number) Integer

    DescriptionReturns the next character. This command will return a -1 if the end of filreached. This is much faster than using the FileSeek of FilePeek comman

    Channel - The file channel to test. (1-5) This must be a number.

    FileReadFile()

    FileReadFile(Channel)FileReadFile(number) String

    DescriptionReturns the the complete file from the current position. If the file is openebinary mode this will be raw byte data.

    Channel - The file channel to test. (1-5) This must be a number.

    func main()

    FileOpen(1,".FileTest.txt",BinaryOpen)

    Loop:if FileEOF(1) = 0 then

    print "Current character is "+FileRead(1)+" at pos "+FilePos(1)

    goto Loopendif

    FileClose(1)print "All Done"

    endfunc

    func main()

    FileOpen(1,".FileTest.txt",Open)

    Loop:if FileEOF(1) = 0 then

    print FileRead(1)goto Loop

    endif

    FileClose(1)print "All Done"

    endfunc

    func main()

    dim fdat as stringdim x as integer

    FileOpen(1,".FileTest.txt",BinaryOpen)fdat = FileReadFile(1)FileClose(1)

    for x = 0 to Len(fdat)print mid(fdat,x,1);

    next

    endfunc

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    50/177

    FileReadLine

    Zeus www.krmicros.comPage 50

    File Commands

    FileReadLine()

    FileReadLine(Channel)FileReadLine(number) Integer

    DescriptionReturns the next line of data from the file. *Not available in Binary Mode

    Channel - The file channel to test. (1-5) This must be a number.

    FileSeek()

    FileSeek(Channel,Offset)FileSeek(number,Iexp) integer

    Description

    Moves the file pointer on a file opened for read. Returns 1 of successful and0 if an error. This command can be used standalone if you don't care aboutthe result.

    Channel - The file channel to close. (1-5) This must be a number. Offset - The position to move the pointer.

    FileWrite()

    FileWrite(Channel,String)

    FileWrite(number,Sexp) integer

    DescriptionWrites a character to the current file. Returns 1 of successful and 0 if anerror. This command can be used standalone if you don't care about theresult.

    Channel - The file channel to test. (1-5) This must be a number. String - A string containing the character/s to write.

    func main()

    dim ldat as stringdim x as integer

    FileOpen(1,".FileTest.txt",Open)

    Loop:if FileEOF(1) = 1 then

    FileClose(1)End

    endif

    ldat = FileReadLine(1)print ldatgoto Loop

    endfunc

    main()

    dim fdat as string

    FileOpen(1,".FileTest.txt",Open)FileSeek(1,20)fdat=FileReadLine(1)print fdatFileClose(1)

    endfunc

    func main()

    dim fdat as string

    FileOpen(1,".writetest",Create)FileWrite(1,"Hello")FileWrite(1,"Goodby")FileWrite(1,"ItWorks")FileClose(1)

    FileOpen(1,".writetest",Open)fdat=FileReadFile(1)FileClose(1)print fdat

    endfunc

    All

    All

    All

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    51/177

    FileWriteLi

    Zeus www.krmicros.com Page

    File Commands

    FileWriteFile()

    FileWriteFile(Channel,String)FileWriteFile(number,sexp) integer

    DescriptionWrites a raw data string to the current file from the current position. Returof successful and 0 if an error. This command can be used standalone if ydon't care about the result.

    Channel - The file channel to test. (1-5) This must be a number. String - A string containing the data to write.

    FileWriteLine()

    FileWriteLine(Channel,String)FileWriteLine(number,Sexp) integer

    DescriptionWrites a string of characters and newline character to the current file. *Noavailable in Binary Mode. This command can be called standalone if youdon't care about the result.

    Channel - The file channel to test. (1-5) This must be a number. String - A string containing the data to write.

    func main()dim fdat as string

    fdat = "Now is the time for all good men to come to the aid of their country."+chr(13)+chr(10)

    FileOpen(1,".data",Create)FileWriteFile(1,fdat)FileClose(1)

    endfunc

    func main()

    FileOpen(1,".filetest",Create)FileWriteLine(1,"Now is the Time")FileClose(1)

    endfunc

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    52/177

    FileQuickAdd

    Zeus www.krmicros.comPage 52

    File Commands

    FileQuickAdd()

    FileQuickAdd(File,Data)FileQuickAdd(Sexp,exp) integer

    DescriptionOpens a file in and adds a line of data to that file. The File is closed afterthe write. Note that no channel number is needed for this command.Returns 1 of successful and 0 if an error. This command can be usedstandalone if you don't care about the result.

    File - The file name to open. If you begin with a . then the current Zeusdirectory will be used for the file.

    Data - The Data to write.

    FileQuickLoad()

    FileQuickLoad(File)FileQuickLoad(Sexp) String

    DescriptionOpens a file and reads in the first line of data and returns it. The file isclosed after the read. Note that no channel number is needed for thiscommand.

    File - The file name to open. If you begin with a . then the current Zeusdirectory will be used for the file.

    FileQuickLoadAll()

    FileQuickLoadAll(File)FileQuickLoadAll(Sexp) String

    DescriptionOpens a file and reads in all of the file and returns it. The file is closed afterthe read. Note that no channel number is needed for this command.

    File - The file name to open. If you begin with a . then the current Zeusdirectory will be used for the file.

    func main()

    FileQuickAdd(".testit.txt","Line1")FileQuickAdd(".testit.txt","Line2")FileQuickAdd(".testit.txt","Line3")

    endfunc

    func main()

    dim num as integer

    num = FileQuickLoad(".gennumber")print numnum = num + 1FileQuickSave(".gennumber",num)

    num = FileQuickLoad(".gennumber")print numnum = num + 1FileQuickSave(".gennumber",num)

    num = FileQuickLoad(".gennumber")print num

    endfunc

    Zp Pz

    func main()

    dim ostr as stringdim istr as string

    ostr = "Now is the time"+chr(13)+chr(10)+"for all good men"FileQuickSaveAll(".fqsa",ostr)

    istr = FileQuickLoadAll(".fqsa")print istr

    endfunc

    All

    All

    ZW5 ZC5 ZC ZCLCE

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    53/177

    FileQuickSa

    Zeus www.krmicros.com Page

    File Commands

    FileQuickSave()

    FileQuickSave(File,Data)FileQuickSave(Sexp,exp) integer

    DescriptionCreates a new file in and writes a line of data to that file. The File is closeafter the write. Note that no channel number is needed for this command.Returns 1 of successful and 0 if an error. This command can be usedstandalone if you don't care about the result.

    File - The file name to open. If you begin with a . then the current Zeudirectory will be used for the file.

    Data - The Data to write.

    FileQuickSaveAll()

    FileQuickSaveAll(File,Data)FileQuickSaveAll(Sexp,exp) integer

    DescriptionCreates a new file in and writes the passed expression of data to that file.The File is closed after the write. Note that no channel number is needed fthis command. Returns 1 of successful and 0 if an error. This command cbe used standalone if you don't care about the result.

    File - The file name to open. If you begin with a . then the current Zeudirectory will be used for the file.

    Data - The Data to write. This data may contain multiple lines.

    func main()

    dim num as integer

    num = FileQuickLoad(".gennumber")print numnum = num + 1FileQuickSave(".gennumber",num)

    num = FileQuickLoad(".gennumber")print numnum = num + 1FileQuickSave(".gennumber",num)

    num = FileQuickLoad(".gennumber")print num

    endfunc

    Zp

    func main()

    dim ostr as stringdim istr as string

    ostr = "Now is the time"+chr(13)+chr(10)+"for all good men"FileQuickSaveAll(".fqsa",ostr)

    istr = FileQuickLoadAll(".fqsa")print istr

    endfunc

    ZW5 ZC5 ZC ZCLCE

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    54/177

    FormAddPoint

    Zeus www.krmicros.comPage 54

    Form Commands

    FormAddPoint()

    FormAddPoint(ID [,XPoint,YPoint,Xpoint,YPoint.....])FormAddPoint(Iexp [,Iexp,Iexp,Iexp,Iexp...])

    DescriptionAdds points to a polygon shape.

    ID - The ID of the Polygon. XPoint,YPoint - These are the point pairs. They are optional but must beprovided in pairs.

    FormBGColor()

    FormBGColor(Red,Green,Blue)FormBGColor(Iexp,Iexp,Iexp)

    DescriptionSets the Background color of the form. This will affect the FormPrint,FormLabel, FormTextBox and FormCls commands.

    Red - The color of the Red element. 0-255 Green - The color of the Green element. 0-255 Blue - The color of the Blue element. 0-255

    FormBitmapColor()

    FormBitmapColor(Image,Red,Green,Blue)FormBitmapColor(lexp,lexp,Iexp,Iexp)

    DescriptionSets the color that will become transparent for the indicated bitmap image.

    Image - The image number that you want to set. Red - The color of the Red element. 0-255 Green - The color of the Green element. 0-255 Blue - The color of the Blue element. 0-255

    FormBitmapColorClear()

    FormBitmapColorClear(Image)FormBitmapColorClear(Iexp)

    DescriptionClears the transparent color mask so that no color is transparent.

    Image - The image number that you want to set.

    Zp Pz

    Zp Pz

    Zp Pz

    Zp Pz

    func main()FormCLS()FormCreatePoly(0)FormAddPoint(0,10,10,20,10,20,20,10,20,10,10)FormPolyBrush(0,255,0,0)

    dim x as integerdim y as integer

    for y = 1 to 120 step 12for x = 1 to 120 step 12FormDrawFillPoly(0,x,y)FormDrawPoly(0,x,y)

    nextnext

    endfunc

    func main()

    dim mflag,mx,my

    formloadbitmap(0,".ball4.bmp")formbitmapcolor(0,255,255,255)

    formdrawbitmap(0,10,10)

    endfunc

    ZW5 ZC5

    ZW5 ZC5

    ZW5 ZC5

    ZW5 ZC5

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    55/177

    FormBitmapTarg

    Zeus www.krmicros.com Page

    Form Commands

    FormBitmapSave()

    FormBitmapSave(Image,FileName,Type)FormBitmapSave(Iexp,Sexp,Iexp)

    DescriptionSaves the form graphics or a bitmap to a file.

    Image - The image number that you want to set. If set to -1 the formgraphics will be saved as a bitmap. Note that this does not includeButtons, Labels or Textboxes.

    FileName - The name of the file to save the bitmap to. By using a "." the first field of the name forces the file to be saved in the same dir as application.

    Type - This the type of file to save. 0=Bitmap, 1=Gif, 2=Icon, 3=Jpeg4=Tiff, 5=Wmf *Bitmap is the only format available on the Pocket

    FormBitmapSource()

    FormBitmapSource(Image,Xpos,Ypos,Width,Height)FormBitmapSource(Iexp,Iexp,Iexp,Iexp,Iexp)

    DescriptionSets the source values for the bitmap draw. You can select any portion ofloaded bitmap to display.

    Image - The image number that you want to set. Xpos - The X position on the source image to use. Ypos - The Y position on the source image to use. Width - The width of the source image to use.

    Height - The height of the source image to use.

    Note that if the source and target Height and Width parameters are not thesame the image will be stretched or shrunk automatically when displayed.

    FormBitmapTarget()

    FormBitmapTarget(Image,Xpos,Ypos,Width,Height)FormBitmapTarget(Iexp,Iexp,Iexp,Iexp,Iexp)

    Description

    Sets the target values for the bitmap draw.

    Image - The image number that you want to set. Xpos - The X position on the target image to use. Ypos - The Y position on the target image to use. Width - The width of the target image to use. Height - The height of the target image to use.

    Note that if the source and target Height and Width parameters are not thesame the image will be stretched or shrunk automatically when displayed.

    Zp

    Zp

    Zp

    func main()

    FormBitmapSave(-1,".tfile.bmp",0)

    endfunc

    ZW5 ZC5

    ZW5 ZC5

    ZW5 ZC5

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    56/177

    FormBrush

    Zeus www.krmicros.comPage 56

    Form Commands

    FormBrush()

    FormBrush(Red,Green,Blue)FormBrush(lexp,Iexp,Iexp)

    DescriptionSets the Fill color for the FormFillRectangle and FormFillEllipse commands.

    Red - The color of the Red element. 0-255 Green - The color of the Green element. 0-255 Blue - The color of the Blue element. 0-255

    FormButton()

    FormButton(ID,XPos,YPos,Width,Height,Text)FormButton(Iexp,Iexp,Iexp,Iexp,Iexp,Sexp)

    Description

    Creates a working button on the Zeus form.

    ID - This is used to identify the button, Don't use large numbers for ID's atbutton is created for all unused ID's. For instance An ID of 10 will create 10buttons. It is best to use consecutive numbers. They don't need to becreated in order.

    Xpos - The X coordinate on the form for the upper left hand position of thecontrol.

    YPos - The Y coordinate on the form for the upper left hand position of thecontrol.

    Width - The width of the control in pixels. Height - The height of the control in pixels. The Height parameter has a

    couple options overrides.

    If the value is any of the following all other parameters will be ignored andthe following will take place

    -1=Ignore parameter-10=Disable Button-11=Enable Button-20=Make Button Invisible-21=Make Button Visible-31=Force Focus

    Text - the text to appears in the control. If you place a chr(0) in this fieldthe original text will not be altered by the command.

    Note that after the first to this control you can pass a -1 to theXpos,Ypos,Width, and Height parameters and they will regain thereoriginal location. This way you can update only the text if you wish.

    Zp Pz PzL

    Zp Pz PzL 'Simple Progress Bar Demofunc main()

    dim x,maxvalmaxval = 55for x =0 to maxval

    ProgressBar(10,200,220,10,x,maxval)pause(5)

    nextendfunc

    '-- simple progress bar ------------------' xpos,ypos sets location' width,height sets size' curval = current state of bar' maxval is the maximum value'-----------------------------------------func ProgressBar(x,y,width,height,curval,maxval)

    formbrush(0,255,0)formfillrectangle(x,y,float(curval* (width/maxval)),height)formrectangle(x,y,width,height)formupdate()

    endfunc

    Zl

    ZlZW5 ZC5

    ZW5 ZC5

    http://www.krmicros.com/http://www.krmicros.com/
  • 7/29/2019 manuale Zeus

    57/177

    FormCreatePo

    Zeus www.krmicros.com Page

    Form Commands

    FormButton()

    FormButt