Contents / Reference section / BASIC keywords / Previous letter / Next letter / Index


T

TAB tabulation

Purpose

TAB can only be used with the keywords PRINT and INPUT. There are two versions:

TAB(X) will print spaces up to a certain column position. If the flashing cursor is beyond the required position then the cursor will move to the next line down and space across the required column.

TAB(X,Y) will move the cursor directly to position X, Y on the screen. Note that once TAB(X,Y) has been used on a line, TAB(X) may not move to the correct position on the line.

The origin (for all text commands) is at the top left of the current text area of the screen.

The left hand column of the screen is column number 0. The right hand is column 19, 39, or 79 depending on the graphics mode selected.

The top line is line number 0, the bottom line is line number 31 or 24.

If the text scrolling area of the screen is changed then the TAB command will still work as outlined above.

Examples

340 PRINT TAB(10);name$TAB(30);job$

440 PRINT TAB(20,31);value

230 INPUT TAB(10,20) "How much" cost

875 INPUT TAB(30), "Doctors name", DOC$

Description

TAB with a single argument prints spaces (and a newline if necessary) to reach the specified column.

TAB with two arguments moves the cursor directly to the specified co-ordinates.

Syntax

PRINT TAB(<numeric>[,<numeric>])

or

INPUT TAB(<numeric>[,<numeric>])

Associated keywords

POS, VPOS, PRINT, INPUT

TAN tangent

Purpose

This mathematical function calculates the tangent of the angle given.

The angle must be given in radians but may be converted to radians from degrees using the function RAD. 1 radian is about 57 degrees.

Examples

PRINT TAN(RAD(45))

10 Y=TAN (X)

1030 droop=TAN(load)

Description

A function returning the tangent of the argument. The argument must be given in radians.

Syntax

<num-var>=TAN<numeric>

Associated keywords

COS, SIN, ACS, ATN, DEG, RAD

THEN

Purpose

A keyword used with IF to decide on a course of action as the result of some test.

Examples

780 IFX=6 THEN PRINT "good" ELSE PRINT "bad"

200 IF A$=B$ THEN PROCgood ELSE PROCbad

Description

Optional part of the IF...THEN...ELSE structure.

Note that it is not optional if used when the condition assigns to a pseudo variable, eg

300 IF X THEN TIME=0

Syntax

IF <testable condition>THEN<statement>[ELSE<statement>]

Associated keywords

IF, ELSE

TIME

Purpose

This can be used to set or read the internal timer.

The timer counts in one hundredth of a second intervals. It is not a clock providing true time-of-day readout. You can't use it to check the Greenwich Time Signal! However once set, the internal clock will keep good time. Pressing the BREAK key does not reset the clock.

To convert TIME to a 24 hour clock use the following routines:

1000 SEC=(TIME DIV 100)MOD 60

1010 MIN=(TIME DIV 6000)MOD 60

1020 HR =(TIME DIV 360000)MOD 24

Examples

205 TIME=((Ho*60+Mi)*60+Se)*100

400 nowtime=TIME

Description

A pseudo-variable which sets or reads the lower four bytes of the internal elapsed time clock.

Syntax

TIME=<numeric>

or

<num-var>=TIME

Demonstration program

1070 finishtime=TIME+1000

1080 REPEAT

1090 REM wait for 10 seconds

1100 UNTIL TIME>=finishtime

TO

Purpose

Part of the FOR...TO...STEP...NEXT statement. The final terminating value of the loop is given after the word TO. See page 91 for further information.

Description

Part of the FOR...NEXT construct.

Syntax

FOR<num-var>=<numeric>TO<numeric> [STEP <numeric>]

Associated keywords

FOR, STEP, NEXT

Demonstration program

10 MODE 5

20 FOR C=l TO 3

30 GCOL 3,C

40 FOR X=0 TO 1200 STEP 5*C

50 MOVE 600,1000

60 DRAW X,0

70 NEXT X

80 NEXT C

TOP

Purpose

The function TOP returns the address of the first free memory location after the user's program. The user's program is normally stored from the bottom of the available Random Access Memory upwards.

Thus the length of the user's program in bytes is given by

TOP-PAGE.

Examples

PRINT~(TOP-PAGE):REM length in hex

2340 PRINT TOP

5460 X=TOP

Description

A function returning the first free location above the user's program.

Syntax

<num-var>=TOP

Associated keywords

PAGE, HIMEM, LOMEM

TRACE

Purpose

TRACE makes the computer print out the line number of each line of the program before execution.

There are three forms of TRACE:

TRACE ON causes the computer to print line numbers

TRACE OFF turns off the trace facility

TRACE 6780 would cause the computer to report only line numbers below 6780.

With well-structured programs which have subroutines at high line numbers this will enable the user to trace through the structure of the program without being bothered with line numbers in procedures, functions and subroutines.

Note that the interpreter does not execute line numbers very often

10 FOR Z=0 TO 100

20 Q=Q*Z: NEXT Z

30 END

would print [10] [20] [30] but

10 FOR Z=0 TO 100

20 Q=Q*Z

25 NEXT Z

30 END

would print [10] [20] [25] [25] [25] [25] [25]

(Of course in MODE 7 the [ appears as ← and ] appears as →.)

TRACE is also turned off after an error, or by pressing ESCAPE or BREAK.

Examples

TRACE ON

TRACE OFF

TRACE X

TRACE 3000

Description

TRACE ON causes the interpreter to print executed line numbers when it encounters them.

TRACE X sets a limit on the size of line numbers which may be printed out; only numbers less than X will be printed.

TRACE OFF turns trace mode off.

Syntax

TRACE ON|OFF|<numeric>

TRUE

Purpose

TRUE is represented by the value -1 in this computer.

Examples

PRINT TRUE

300 UNTIL result = TRUE

Description

A function returning -1.

Syntax

<num-var>=TRUE

Associated keywords

FALSE

Exit: BBC Microcomputer User Guide; Kasoft Typesetting; Archer


The BBC Microcomputer User Guide was written by John Coll and edited by David Allen for the British Broadcasting Corporation.

Optical character recognition and original formatting effort by Mark Usher.

HTML version maintained by: Kade "Archer" Hansson; e-mail: archer@dialix.com.au

Last updated: Monday 12th February 2001