APPEND

saves current field values as a new record at the end of the current file and sets currend record pointer to this record

see also: UPDATE TRAP


AT col%,row%

positions cursor in specified column and row


BACK

sets current record pointer to previous record

see also: NEXT FIRST LAST POSITION EOF TRAP


BEEP millisec%,tone%

produces a tone in specified frequency and duration

tone%=(921600/frequency)-39
freq. for A = 440 Hz, next octave *2

Note: A short beep can be produced by PRINT CHR$(9);


BREAK

break a DO/UNTIL, WHILE/ENDWH loop

continues programm execution at first command after the UNTIL or ENDWH statement

see also: DO/UNTIL WHILE/ENDWH CONTINUE


CLOSE

closes current file

see also: OPEN TRAP


CLS

clears the screen

Note: PRINT CHR$(12); also clears the screen


CONTINUE

continues programm execution at beginning of a loop, skipping the rest of commands in the loop

Example:
        DO                              WHILE lexp1
          <commandlist 1>                 <commandlist 1>
          IF lexp2                        IF lexp2
            CONTINUE                        CONTINUE
          ENDIF                           ENDIF
          <commandlist 2>                 <commandlist 2>
        UNTIL lexp1                     ENDWH
In the above examples, the commands in list 1 will be executed every time, the ones in list 2 will only be executed if lexp2 returns FALSE

see also: DO/UNTIIL WHILE/ENDWH BREAK


COPY "dev:[file1]","dev:[file2]"

copies a specified data file (or all data files, if only the pack is specified) to another pack.

If the file already exists, the contents of the file will be appended to the existing file.

see also: COPYW TRAP


COPYW "dev:[file1.ext]","dev:[file2]" (LZ only)

Copy file(s) of any type, wildcards + and * are allowed

Valid extensions:

ODB...Datafiles and LZ diary files
DIA.....Diary files (CM/XP format)
OPL....OPL source and code
OPT....OPL source
OPO...OPL code
COM...CommsLink setup files
PLN.....Spreadsheet files
PAG....Pager files
NTS.....Notepad files
see also: COPY TRAP
CREATE file$,handle, fieldname[%|$][,fieldname...]

creates & opens file, defines up to 16 fieldvars

sets current file pointer to this file and current record pointer to first record

max. 4 files may be opened at the same time (handles A to D)

see also: OPEN CLOSE TRAP


CURSOR ON|OFF

shows/hides cursor

Note: cursor is always on in EDIT and INPUT


DELETE file$

deletes datafile file$ (or marks it as deleted on Datapacks)

see also: DELETEW TRAP


DELETEW "dev:file.ext" (LZ only)

deletes file(s) of any type, wildcards + and * are allowed

Valid extensions:

ODB...Datafiles and LZ diary files
DIA.....Diary files (CM/XP format)
OPL....OPL source and code
OPT....OPL source
OPO...OPL code
COM...CommsLink setup files
PLN.....Spreadsheet files
PAG....Pager files
NTS.....Notepad files
see also: DELETE TRAP
DO <commandlist>
[BREAK]
[CONTINUE]
<commandlist>
UNTIL lexp

executes a list of commands until lexp returns TRUE

see also: WHILE/ENDWH BREAK CONTINUE


EDIT var$|field$

allows editing of the content of a string variable / field-variable

see also: INPUT TRAP


ERASE

deletes current record, the current record pointer is set to the following record

see also: TRAP


ESCAPE ON|OFF

ESCAPE ON (default)
pressing ON/CLEAR halts the program. If you press Q now, error 206 (ESCAPE) will be raised to stop program execution, any other key resumes program execution.

ESCAPE OFF
program execution is not stopped

WARNING: If your program goes into a neverending loop and ESCAPE is OFF, the only thing you can do is to remove the battery! Try to remove it only for some seconds and you might not loose all your data (don't count on that!)

Note: If you own a nationalized Organizer, the Escape key sequence might be different (e.g. the german one is ON/CLEAR + A)


FIRST

sets current record pointer to the first record in the current file

see also: LAST NEXT BACK POSITION TRAP


GLOBAL name[%][,...] declares a global float or integer variable
GLOBAL name[%](elements)[,...] declares a global float/integer array
GLOBAL name$(size)[,...] declares and sizes a global string variable
GLOBAL name$(elements,size)[,...] declares and sizes a global string array

Global variables are seen in the procedure they are declared in and all subsequent procedures.

Notes:
- Strings must be seized (1..255).
- Arrays can only have one dimension, the number of elements is limited only by available memory.
- Any variable must be declared at the very beginning of the procedure (before any command/function is called)

see also: LOCAL


GOTO label::

continues program execution at a label

Labels are composed of a name followed by two colons. The label must be first item in the line.

Note: The excessive use of GOTO is BAD PROGRAMMING STYLE (spaghetti code)! Use IF/ENDIF, DO/UNTIL or WHILE/ENDWH instead!

Hint: Unlike most other programming languages, it is possible not only to exit a loop or a IF branch via GOTO but also to (re)enter it.

see also: IF/ENDIF DO/UNTIL WHILE/ENDWH


IF lexp1 <commandlist> [ELSEIF lexp2] <commandlist> [ELSE] <commandlist> ENDIF

executes different commands depending on the results of lexp

Note: ELSE[IF] and ENDIF are seperate commands, so the next statement must be in a new line or seperated by a colon (e.g. IF HOUR>12 :PRINT "Afternoon" :ELSE :PRINT "Morning" :ENDIF)


INPUT var[$]|field[$]

inputs data from keyboard to a string or numeric variable/field-variable

see also: EDIT TRAP


KSTAT n%

sets the keyboard mode

n%=1....upper characters
n%=2....lower characters
n%=3....numerical keyboard, upper characters
n%=4....numerical keyboard, lower characters


LAST

sets current record pointer to the last record in the current file

see also: FIRST NEXT BACK POSITION TRAP


LOCAL name[%][,...] declares a local float or integer variable
LOCAL name[%](elements)[,...] declares a local float/integer array
LOCAL name$(size)[,...] declares and sizes a local string variable
LOCAL name$(elements,size)[,...] declares and sizes a local string array

Local variables are only seen in the procedure they were declared in.

Notes:
- Strings must be seized (1..255).
- Arrays can only have one dimension, the number of elements is limited only by available memory.
- Any variable must be declared at the very beginning of the procedure (before any command/function is called)

see also: GLOBAL


LPRINT (CommsLink required)

prints to serial device

parameters see: PRINT

see also: PRINT LSET:


(CommsLink required)
LSET:( baud%, 9600|4800|2400|1200|600|300|150|110|75|50
parity%, 0..none, 1..odd, 2..even, 3..mark, 4..space
bits%, 7|8
stop%, 1|2
hand%, Handshake: 0..none, 1..XON, 2..RTS, 3..XON+RTS, 4..DTR, 5..XON+DTR, 6..RTS+DTR, 7..all
echo%, 0..local, 1..host
width%, 0..none, 1..254 max. line width
reol$, receive EOL-character(s) (len=0..2, default: CR+LF)
reof$, receive EOF-character(s) (len=0..2, default: SUB ($1A))
rtrn$, receive translation table (pairs of characters, default: "")
teol$, transmit EOL-character(s) (len=0..2, default: CR+LF)
teof$, transmit EOF-character(s) (len=0..2, default: SUB)
ttrn$, transmit translation table (pairs of characters, default: "")
timeout%, 0..none, 1..255 secs
protocol%) 0..none, 1..XMODEM, 2..psion

CommsLink Setup

Note: You do not have to enter all parameters, -1 acts as dummy even for strings
e.g. LSET:(-1,-1,-1,-1,2) sets RTS-Handshaking on, leaving other settings intact


NEXT

sets current record pointer to next record in the current file

see also: BACK FIRST LAST POSITION EOF TRAP


OFF

turns off Organizer, program execution is continued after waking organizer

OFF n% (LZ only)

turns off Organizer for specified time (in seconds, max. 1800)


ONERR label::|OFF

ONERR label::
activates error trapping, if an error occurs, the program execution will be continued at the label

ONERR OFF
disactivates error trapping

Labels are composed of a name followed by two colons. The label must be first item in the line.

see also: TRAP


OPEN file$, handle, fieldname[%|$] [,fieldname...]

opens an existing file and defines up to 16 fieldvars

sets current file pointer to this file and current record pointer to first record

max. 4 files may be opened at the same time (handles A to D)

see also: CREATE TRAP


PAUSE n

pauses program execution

n=0....wait for key
n<0....wait n/20 secs for key
n>0....pause n/20 secs

Does not remove the key from the keybuffer!


POKEB addr%,byte%

writes a byte into memory at address addr% (at your own risk!)

If the address is in the protected range $00 to $3F or $282 to $400 then it does nothing.

see also: POKEW PEEKB PEEKW


POKEW addr%,word%

writes word (2 bytes) into memory at address addr% and addr%+1 (at your own risk!)

If the address is in the protected range $00 to $3F or $282 to $400 then it does nothing.

see also: POKEB PEEKB PEEKW


POSITION n

sets current record pointer to the n'th record of current file

see also: NEXT BACK FIRST LAST EOF TRAP


PRINT [exp[,|;[exp...]]]

shows expression results on display
comma inserts 1 blank, seperator at end of command disables new line

see also: DISP VIEW


RAISE n%

artifically generates error no. n%

see also: ONERR ERR


RANDOMIZE any_number

initializes random number generator

Note: if you use a number again, the resulting 'random' number set will be the same too!

see also: RND


REM

remark (rest of line will be ignored)


RENAME file1$,file2$

renames a file (not for moving over devices!)

see also: COPY TRAP


RETURN [exp]

returns to calling procedure
if used in a function: passes function return value


STOP

stops program execution


UDG u%,p1%,p2%,p3%,p4%,p5%,p6%,p7%,p8% (LZ only)

defines UDG (user defined graphic) u% (0..7) with pattern lines p_% (0..31)

Note: UDGs may be redefined while being displayed - this feature allows small animations!
CMs and some very old XPs erase UDGs when turned off.

The following procedure is the replacement for the UDG command on CM/XP's:

UDG:(u%,p1%,p2%,p3%,p4%,p5%,p6%,p7%,p8%)
POKEB $180, 64+(u% AND 7)*8
POKEB $181, p1%
POKEB $181, p2%
POKEB $181, p3%
POKEB $181, p4%
POKEB $181, p5%
POKEB $181, p6%
POKEB $181, p7%
POKEB $181, p8%

Click here for an example!


UPDATE

deletes current record, appends current field values as new record in current file,
sets current record pointer to this record which is always the last one

see also: APPEND TRAP


USE handle

sets current file pointer to an already opened file

see also: OPEN TRAP


WHILE lexp <commandlist>
[BREAK]
[CONTINUE]
<commandlist>
ENDWH

repeats commands while lexp is TRUE

see also: DO/UNTIL BREAK CONTINUE


XFCLOSE: (CommsLink required!)

closes a file opened by XFOPEN:() (no error if none open)

see also: XFOPEN:


XFOPEN:(remotefile$, openmode%,filetype%) (CommsLink required!)

opens remote file on PC-Server (CL.EXE)

"/" is converted to "\" in remotefile$

openmode%:

0....read only
1....create or replace
2....replace
3....create
4....update
filetyp%: 0....random access
1....text (append mode)
2....directory
If you are using Psi2Win, there is another option: 3....directory (long filenames)
Please note that you must size the buffer x$ to 255 bytes for long filenames!

see also: XFCLOSE: XFPOS: XFGET: XFPUT: XFEOF:


XFPUT:(x$) (CommsLink required!)

writes data to an open remote file

random access files: writes x$ at current position
text files: appends x$ as new record

see also: XFOPEN: XFPOS: XFGET:


XLCON: (CommsLink required - undocumented feature!)

low level link protocol command, establishes a connection

see also: XLDIS: XLGET$: XLPUT:


XLDIS: (CommsLink required - undocumented feature!)

low level link protocol command, terminates a connection

see also: XLCON: XLGET$: XLPUT:


XLPUT:(x$) (CommsLink required - undocumented feature!)

low level link protocol command, sends a single frame

May be used to terminate the Commslink server by calling the EXIT overlay:
    XLCON: :XLPUT:("EXIT") :XLDIS:

see also: XLCON: XLDIS: XLGET$:


XMLOAD:(addr%,len%,name$) (CommsLink required - undocumented feature!)

loads the relocatable boot code from remote file name$ to address addr%, but rejects it if the code exceeds length len%.
Absolute addresses in the code are adjusted to starting address addr% by the Commslink server.


XTRECV:(remotefile$,localfile$,filetype%) (CommsLink required!)

receives a file from PC-Server (CL.EXE)

"/" is converted to "\" in remotefile$

filetype%:
value PC-extension type
0 ODB data file
1 OPL OPL-program source file
2 OB2 diary file
3 OB3 executable file (may also contain OPL-source)
4 OB4 CommsLink setup file
5 OB5 spreadsheet file

see also: XTSEND:


XTSEND:(remotefile$,localfile$,filetype%)(CommsLink required!)

sends a file to PC-Server (CL.EXE)

"/" is converted to "\" in remotefile$

filetype%:
value PC-extension type
0 ODB data file
1 OPL OPL-program source file
2 OB2 diary file
3 OB3 executable file (may also contain OPL-source)
4 OB4 CommsLink setup file
5 OB5 spreadsheet file

see also: XTRECV: