# XYBASIC Programming Manual

Show Description

Show Manual

Show PDF

Show Table of Contents

## Summary

This section contains an alphabetical summary of each XYBASIC command, operator, and function, derived from the Short Form Description in Chapter III of the *XYBASIC Programming Manual*. Click on a command name, operator, or function to see the corresponding section of the manual.

### Commands

[command] : [command]

Colon separates commands to allow multiple commands on a single line.

' [unquoted string]

[Command] Delimits an on-line comment. The string is ignored.

? [item list]

[Command] Prints the given items, which may be formulas or strings.

? @[formula], [item list]

[Command] [CP/M] Sends information in item list to file number formula. The items may be formulas or strings. If value of formula is 0, PRINTs items on the console.

[variable] = [formula]

[Command] Assigns the variable the value of the formula.

ASSIGN [logical device] [formula]

[Command] Reassigns the logical device to the physical device specified by formula.

AUTO [line number 1], [line number 2]

[Editing command] Allows entering new lines of a program without typing line numbers, starting at line number 1 with increment line number 2. Both arguments are optional, and are defaulted to 10 if not present.

BREAK [line number], [formula]; [variable1], [variable2]... ; $

[Command] Sets a breakpoint on the given line number, so a break message is printed whenever the line is executed. If the optional formula is present, the break occurs only after the line has been executed formula times. If any variables are listed, their names and values are also printed when the break occurs. XYBASIC then returns to direct mode if the optional $ is present.

BREAK [variable1], [variable2]...

[Command] Sets breakpoints on the given variables, so whenever they are modified the variable name and value are printed.

CALL [number], [parameter1], [parameter2]...

[Command] Calls the machine language subroutine at location specified by number. The parameters are optional, and may be either [variable] or *[array variable].

CLEAR

[Command] Sets all variables to zero or [Extended] the null string.

CLEAR [formula]

[Command] [Extended] Allocates amount of string space given by value of formula. Clears all variables and removes breakpoints.

CLEAR @[formula]

[Command] [CP/M] Allocates space allowing up to formula disk files to be OPEN simultaneously.

CLOSE

CLOSE @[formula]

[Command] [CP/M] Closes all files or the file with file number formula.

CONT

[Direct mode command] Continues execution after STOP, END, <control-C>, or BREAK with # option.

DATA [item1], [item2]...

[Command] Provides data for READ command.

DEF FN [variable1] (variable2, ...) = [formula]

[Command] Defines a function named FN variable1. The parameters (variable2, ...) are optional.

DEF INT [letter1] - [letter2]

DEF SNG [letter1] - [letter2]

DEF STR [letter1] - [letter2]

[Command] [Extended] Resets the default variable type for variable names starting with letter1 through letter2 to INTeger, SiNGle precision floating point or STRing. - [letter2] is optional; if omitted, resets the default variable type for variable names starting with letter1.

DELETE [line number 1], [line number 2]

[Editing command] Deletes section of XYBASIC program starting at line number 1 and ending at line number 2. If line number 2 is omitted, deletes line number 1. If specified line numbers are not found, deletes all lines following line number 1 and preceding line number 2.

DELAY [formula1], [formula2], [formula3]

[Command] DELAY suspends program execution for formula1 minutes, formula2 seconds and formula3 hundredths of seconds, where formula2 and formula3 are optional.

DIM [variable] (formula, ...)

[Command] Allocates space for an array with name specified by variable, and initializes all array elements to zero or [Extended] the null string.

DIR [string]

[Command] [CP/M] Prints the names of all files with filenames matching the given string. If string is omitted, prints the names of all files on the currently logged disk.

DISABLE [line number]

[Command] Removes the interrupt set by the given line number; removes all interrupts if no line number is given.

EDIT [line number]

[Editing command] Allows changing line given by line number of current program without retyping entire line. If the line number is omitted, EDITs the line most recently added to the program or line in which most recent error occurred.

ENABLE [line number], [formula1], [formula2], [formula3], $

[Command] Specifies an interrupt condition to be tested before each command is executed. The condition is fulfilled if the value on input port formula1 matches the value of formula2, masked by optional formula3; if the optional $ is present, the condition is fulfilled if any bit matches. If it is not fulfilled, program execution continues normally; if it is fulfilled, an interrupt occurs and control is transferred to the subroutine at the given line number.

END

[Command] Ends program execution and returns to direct mode.

EXEC [formula]

[Command] Uses the program at location formula rather than the program in working space. If the formula is omitted, uses the program in working space.

FOR [variable] = [formula1] TO [formula2] STEP [formula3]

[Command] Indicates the beginning of a FOR / NEXT loop.

GOSUB [line number]

[Command] Transfers control to the subroutine at the specified line number.

GOTO [line number]

[Command] Transfers control to the specified line number.

IF [logical formula] THEN [line number]

IF [logical formula] THEN [command]

[Command] Evaluates the logical formula. If true, transfers control to the line number or executes command following THEN. If false, transfers control to line following the IF / THEN command.

INPUT [quoted string] [variable1], [variable2]...

[Command] Requests data from the console, prompting the user with the optional string followed by ?. Assigns values typed in to the variables listed.

INPUT @[formula], [variab1e1], ...

[Command] [CP/M] Reads information from file number formula and assigns to variable1,... If value of formula is 0, performs a normal INPUT from the console.

LET [variable] = [formula]

[Command] Assigns the variable the value of the formula. The LET is optional.

LINPUT [string variable]

[Command] [CP/M] LINPUT @[formula], [string variable]

Reads a line of characters from the console or from file number formula and assigns string variable the string consisting of the characters, not including <carriage return>. If value of formula is 0, does a LINPUT from the console.

LIST [line number1], [line number2]

[Command] Lists the current program. If no line number is specified, the entire program is listed. If line number1 is present, the listing starts at that line. If line number2 is present, the listing ends at that line.

LOAD [string] ,A ,R

[Command] [CP/M] Loads the program from the specified file. The ,R suffix is optional; if specified, XYBASIC RUNs the file after loading it.

LOAD [quoted string]

[Command] [Custom I/O] Loads a program through the ReaDeR device. If the quoted string is omitted, XYBASIC loads the first program it finds.

LOAD [diskname] [quoted string]

LOAD [diskname] [quoted string] ,A

LOAD [diskname] [quoted string] ,H

[Command] [ISIS-II] Loads the program from the specified file.

MARGIN @[formula1], [formula2]

[Command] [CP/M] Specifies formula2 as maximum width for output lines on file number formula1. If value of formula1 is 0, changes width of console device output line to formula2.

MOVE FROM [formula]

[Command] [Custom I/O] Copies the program from the specified location to XYBASIC's working space.

MOVE TO [formula]

[Command] [Custom I/O] Copies the program from XYBASIC's working space to the specified location.

NEW

[Direct mode command] Deletes the current program and clears all variables to zero or [Extended] the null string.

NEXT [variable1], [variable2]...

[Command] Indicates the end of a FOR / NEXT loop.

NULL [formula]

[Command] Instructs XYBASIC to send the console the number of nulls specified by formula after each <carriage return> and <line feed>; this number is initially 0.

ON [formula] GOTO [line number], [line number]...

ON [formula] GOSUB [line number], [line number]...

[Command] Transfers control to the Ith line number in the list, where I is the truncated value of the formula.

OPEN I, @[formula], [string]

OPEN O, @[formula], [string]

OPEN U, @[formula], [string]

[Command] [CP/M] Opens a disk file for Input, Output or Update. The formula specifies an integer file number between 1 and 255 associated with the file. The string specifies a filename, and may consist of an optional disk name, a filename, and an optional filetype.

OUT [formula1], [formula2]

[Command] Outputs the value of formula2 on the output port specified by formula1.

POKE [formula1], [formula2]

[Command] Puts the value of formula2 into the memory location specified by formula1.

PRINT [item list]

[Command] Prints the given items, which may be formulas or strings. Question mark (?) may be used as abbreviation for PRINT.

PRINT @[formula], [item list]

[Command] [CP/M] Sends information in item list to file number formula. The items may be formulas or strings. Question mark (?) may be used as abbreviation for PRINT. If value of formula is 0, PRINTs items on the console.

RANDOMIZE [formula]

[Command] Uses formula to reinitialize the pseudorandom number generator.

READ [variable1], [variable2]...

[Command] Assigns the specified variables the values from the next unused DATA command.

REM [unquoted string]

[Command] Allows insertion of comments into program. The string is ignored.

RENUM [line number 1], [line number 2], [line number 3]

[Editing command] Renumbers the current program, with line number 1 becoming line number 3 and successive line numbers incremented by line number 2. If line number 3 is omitted, it is assumed to be the same as line number 1. If line number 2 is omitted, it is assumed to be 10. If line number 1 is omitted, it is assumed to be the first line number of the program.

RESTORE [line number]

[Command] Allows DATA to be reused by resetting the DATA pointer to the specified line number, or to the beginning of the program if no line number is specified.

RETURN

[Command] Exits from the subroutine and returns control to the command following the most recent GOSUB executed.

RUN [line number]

[Direct mode command] Begins execution of the current program, starting at the specified line number. If no line number, starts at the lowest line number.

SAVE [string] ,A

[Command] [CP/M] Saves the current program as a disk file.

SAVE [quoted string]

[Command] [Custom I/O] Saves the current program through the PUNch device.

SAVE [diskname] [quoted string]

SAVE [diskname] [quoted string] ,A

SAVE [diskname] [quoted string] ,H

[Command] [ISIS-II] Saves the current program as a disk file. The diskname is optional.

SCALL [number], [integer var1], [integer var2], [integer var3]

[Command] Calls the machine language subroutine at location specified by number. If the optional variables are present, their values are passed in registers BC, DE and HL, and the values in BC, DE and HL when the routine returns are assigned to the variables.

SCRATCH [string]

[Command] [CP/M] Erases the file named string from the disk.

STOP

[Command] Stops program execution, prints a break message on the console and returns to direct mode.

TIME

[Command] Calibrates the DELAY command for nonstandard 8080 systems.

TRACE

[Command] Turns on the trace feature.

TRAP

[Command] Turns on the error trap.

UNBREAK [line number]

UNBREAK [variable1], [variable2]...

[Command] Removes breakpoints set on line numbers or variables, and removes all breakpoints if the optional line number is omitted.

UNTRACE

[Command] Turns off the trace feature.

UNTRAP

[Command] Turns off the error trap.

WAIT [formula1], [formula2], [formula3], $

[Command] Suspends processing until the port specified by formula1 has the value specified by formula2, masked by optional formula3. The optional $ indicates processing is to continue if any bit matches.

### Operators and Functions

[formula1] + [formula2]

[Arithmetic operator] Returns the sum of the formulas.

[string1] + [string2]

[String operator] Returns the string consisting of string1 followed by string2, i.e. concatenates the strings.

[formula1] - [formula2]

[Arithmetic operator] Returns the difference of the formulas.

- [formula2]

[Arithmetic operator] Returns the negation of the formula.

[formula1] * [formula2]

[Arithmetic operator] Returns the product of the formulas.

[formula1] / [formula2]

[Arithmetic operator] Returns the quotient of the formulas.

[formula1] \ [formula2]

[Arithmetic operator] [Extended] Returns the integer quotient of the formulas.

[formula1] ^ [formula2]

[Arithmetic operator] [Extended] Returns formula1 to the formula2 power.

[formula1] = [formula2]

[Logical operator] Returns true if formula1 equals formula2.

[formula1] < [formula2]

[Logical operator] Returns true if formula1 is less than formula2.

[formula1] > [formula2]

[Logical operator] Returns true if formula1 is greater than formula2.

[formula1] <= [formula2]

[Logical operator] Returns true if formula1 is less than or equal to formula2.

[formula1] >= [formula2]

[Logical operator] Returns true if formula1 is greater than or equal to formula2.

[formula1] <> [formula2]

[Logical operator] Returns true if formula1 is not equal to formula2.

ABS (formula)

[Function] Returns the absolute value of the formula.

[formula1] AND [formula2]

[Bitwise operator] Returns the bitwise AND of the formulas.

ASC (string)

[String function] Returns the ASCII value of the first character of string.

ATN (formula)

[Function] [Extended] Returns the arctangent in radians in the range -pi/2 to pi/2 of the value of formula.

BCD (formula)

[Function] Converts the given formula from binary to BCD representation.

BIN (formula)

[Function] Converts the given formula from BCD to binary representation.

BIN$ (formula)

[String function] Returns string consisting of binary representation of integer formula.

CHR$ (formula)

[String function] Returns the string containing the character with ASCII value formula.

COS (formula)

[Function] [Extended] Returns the cosine of the value given in radians by formula.

EOF (formula)

[Function] [CP/M] Returns -1 if the file number formula contains more characters, and returns 0 if not.

EXP (formula)

[Function] [Extended] Returns e ^ formula, where e is the Euler number 2.71828...

FIRST

[Function] Returns the address of the first location used to store the current XYBASIC program.

FN [variable] (formula, ...)

[Function] Evaluates the referenced user-defined function.

FRE

[Function] Returns the amount of free memory in bytes.

FRE$

[String function] [Extended] Returns the amount of free string space in bytes.

GET

[Function] Returns ASCII value (with parity bit reset) of any character typed; returns 0 if no character typed.

GET$

[String function] Returns string consisting of character typed, if any; returns null string if no character typed.

HEX$ (formula)

[String function] Returns string consisting of hexadecimal representation of integer formula.

IN (formula)

[Function] Returns the value on the input port specified by formula.

INSTR (formula, string1, string2)

[String function] Returns the first character position at which string1 contains the substring string2. If optional formula is specified, returns the first character position greater than or equal to formula at which string1 contains string2.

INT (formula)

[Function] [Extended] Returns the integer part of the formula.

IOBYTE

[Function] Returns the value of the system I/O byte.

[formula1] JOIN [formula2]

[Operator] Concatenates two 8-bit values into a 16-bit value.

LAST

[Function] Returns the address of the last location used to store the current XYBASIC program.

LEFT$ (string, formula)

[String function] Returns the leftmost formula characters of string.

LEN (string)

[String function] Returns the length of the string, i.e. the number of characters it contains.

LOG (formula)

[Function] [Extended] Returns the natural logarithm of formula.

LSBYTE (formula)

[Function] Returns the least significant 8 bits of the 16-bit integer value of the formula.

LSHIFT (formula1, formula2)

[Function] Left shifts the integer value of formula1 the number of binary places specified by formula2.

MID$ (string, formula1, formula2)

[String function] Returns the substring of string formula2 characters long, starting at character formula1. If formula2 is omitted, returns the right part of the string starting at character formula1.

[formula1] MOD [formula2]

[Arithmetic operator] Returns the remainder of the integer division of the formulas.

MSBYTE (formula)

[Function] Returns the most significant 8 bits of the 16-bit integer value of the formula.

NOT [formula]

[Bitwise operator] Returns the bitwise NOT of formula.

OCT$ (formula)

[String function] Returns string consisting of octal representation of integer formula.

[formula1] OR [formula2]

[Bitwise operator] Returns the bitwise inclusive OR of the formulas.

PEEK (formula)

[Function] Returns the value in the memory location specified by formula.

POS

[Function] Returns the column number of the most recent character PRINTed by XYBASIC.

RESET (formula1, formula2)

[Function] Resets the bit specified by formula2 to zero in integer formula1.

RIGHT$ (string, formula)

[String function] Returns the rightmost formula characters of string.

RND

[Function] [Integer] Returns a pseudorandom number between 0 and 32767.

RND (formula)

[Function] [Extended] Returns a pseudorandom number between 0 and the value of the given formula.

ROTATE (formula1, formula2)

[Function] Right rotates the integer value of formula1 the number of binary places specified by formula2.

RSHIFT (formula1, formula2)

[Function] Right shifts the integer value of formula1 the number of binary places specified by formula2.

SENSE (formula1, formula2)

[Function] Returns the value of bit number formula2 on the input port formula1.

SET (formula1, formula2)

[Function] Sets the bit specified by formula2 to one in integer formula1.

SGN (formula)

[Function] Returns one if the sign of the formula is positive, zero if zero, and minus one if negative.

SIN (formula)

[Function] [Extended] Returns the sine of the value given in radians by formula.

SPC (formula)

[Print function] Prints formula spaces.

SQR (formula)

[Function] [Extended] Returns the square root of the value of formula.

STR$ (formula)

[String function] Returns the value of formula as a string of characters, as PRINTed by XYBASIC.

TAB (formula)

[Print function] Spaces to the column specified by formula.

TAN (formula)

[Function] [Extended] Returns the tangent of the value given in radians by formula.

TEST (formula1, formula2)

[Function] Returns the value of the bit specified by formula2 in formula1.

UNS (formula)

[Print function] [Extended] Returns the value of the formula, considered as an unsigned 16-bit integer representation.

VAL (string)

[String function] Returns the numeric value of the constant represented by string.

[formula1] XOR [formula2]

[Bitwise operator] Returns the bitwise exclusive OR of the formulas.

The *XYBASIC Programming Manual* was originally © Mark Williams Company.
It is posted here by generous permission of Robert Swartz,
the current copyright holder.

Show Description

Show Manual

Show PDF

Show Table of Contents