BBC BASIC Keywords

BBC BASIC Keywords

ABS

Absolute value (function)

 

Returns the absolute positive value of its argument.

ACS

Arc cosine (function)

 

Returns the arc cosine of its argument in radians. The permitted range of the argument is -1 to +1-

For example,

PRINT DEG(ACS(0.5))

will print 60, because COS(60°) is 0.5.

AND (A.)

Logical AND (operator)

 

Performs a bitwise logical AND between two operands which are internally converted to 4 byte integers before the operation.

It is normally used to join two conditions in an IF or UNTIL statement; thus

IF length >10 AND width > 10 THEN PRINT "OK"

ensures that a rectangle is larger than 10 x 10.

ASC

ASCII value (function)

 

Returns the ASCII character value of the first character of the argument string.

PRINT ASC("Cambridge Z88")

gives 90, the ASCII value of "Z".

The brackets are optional, and ASC"", the null string, gives -1.

ASN

Arc sine (function)

 

Returns the arc sine of its argument in radians. The permitted range of the argument is -1 to +1.

ATN

Arc tangent (function)

 

Returns the arc tangent of its argument in radians.

AUTO (AU.)

Automatic numbering (command)

 

Allows lines to be entered without first typing in the number of the line. The line numbers are preceded by the usual prompt (>).

By default the starting line number and increment are both 10, but they may optionally be specified; for example

AUTO 20

will start with line 20, and

AUTO 100,20

will start at line 100 and increment by 20. AUTO will continue generating line numbers until you press 

 BGET (B.#)

Byte from data file (function)

 

Returns a byte from the data file whose channel number is its argument. The file pointer is incremented after the byte has been read. For example,

character=BGET#c

reads the next character from file c.

 

 BPUT# (BP.#)

Output a byte (statement)

 

 

Puts a byte to the data file whose channel number is the first argument. The second argument's least significant byte is written to the file. The file pointer is incremented after the byte has been written. Thus

BPUT#channel, char

writes char to file channel.

 CALL (CA.)

Call machine-code (statement)

 

Calls a machine code subroutine at a specified address, passing parameters in a parameter block addressed by the Z80's IX register. The IY register is set to the address of the machine code subroutine being called. The processor's A, B, C, D, E, F, H, and L registers are initialised to the least significant bytes of A%, B%, C%, D%, E%, F%, H%, and L% respectively.

This statement could cause corruption of the Cambridge Z88 memory, and should therefore only be used by experienced programmers.

The parameter block contains the following list:

number of parameters

1 byte

(1X+0)

first parameter type

1 byte

(1X+1)

first parameter address

2 bytes

(1X+2,1X+3)

parameter type

) repeated as often

parameter address

) as necessary

where the parameter types are as follows:

Type

Description

0 

8 bit bytes (eg ?a)

4

32 bit integer variable (eg !b or c%)

5

40 bit floating point number (eg d)

128

A string at a defined address (eg $e terminated by a &0D)

129

A string variable such as f$

In the case of a string variable the parameter address is the address of a String Information Block which gives the current length of the string, number of bytes allocated, and start address, in that order.

muldiv=1234
CALL muldiv,A,B$,C%

web analytics