Luxor ABC800-manual-BASIC-II (In) PDF
Luxor ABC800-manual-BASIC-II (In) PDF
This manual describes the BASIC II programming language of ABC 800. The reader
should have programming experience, since the manual is not meant to be a BASIC
textbook.
Chapter 1 introduces the BASIC programming language. Chapter 2 deals with the
structure of BASIC II computer programs.
Chapter 6 describes how to operate BASIC II. This chapter contains plenty of advice
and tips on how to type and edit a program
Chapter 7 deals with the direct usage of instructions and commands, without any
program. This method is particularely useful when a program is being debugged.
Chapters 11 and 12 deal with the ABC 800 graphics. Both the TELETEXTgraphics and
the high resolution graphics with animation mode are described.
Chapter 14 describes the differences between ABC 800 and ABC 80.
Chapter 16, marked with grey edges, contains short descriptions of all instructions,
functions, and commands arranged in alphabetical order.The list in chapter 16 is meant
for use as an index register, where the syntax can be found together with references to
the detailed descriptions earlier in the manual (chapters 8, 9, and 10).
N.B.
Differencies in the BASIC programming language used for ABC 802 and ABC
806 are indicated in the margin as ABC 802 and ABC 806, respectively. The
applicable text explanations are found in appendix 5 (for ABC 802) and
appendix 6 (for ABC 806).
2 The Program....................................................... 2
2.1 Line Numbers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 2
2.2 Comments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 3
2.3 BASIC Statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 3
2.4 Expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 4
2.5 Logical Units. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 5
2.6 Error Handling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 5
3 Data 7
3.1 Range of Values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 7
3.2 Constants ,. . .. 7
3.3 Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 7
3.4 Subscripted Variables and the DIM Statement. .. . . . . . . . . . . . . . . . .. 9
3.5 File Storage 10
3.5.1 Opening a File
3.5.2 Data Transfer To/From a File
3.5.3 Closing a File
5 Character Strings 15
5.1 String Constants 15
5.2 String Variables " 15
5.3 Subscripted String Variables 15
5.4 String Size '.' 15
5.5 String Functions 16
5.6 'String Arithmetic 16
5.7 String Input e . 16
5.8 String Output 17
5.9 Relational Operators 17
III
6.4 Guide to the Statements 20
6.5 Declarations 22
7 Direct Mode 23
8 Commands _ 24
9 Instructions 33
10 Functions 62
10.1 Mathematical Functions 62
10.2 String Functions 67
10.3 Other Functions 72
13 Fu nction Keys 90
15 Error Messages 92
18 Appendices 108
Appendix 1: BASIC II Errata 108
Appendix 2: The I/O Ports of the ABC 800 108
Appendix 3: Storage Disposition 109
Appendix 4: Keyboard Layout, ASCII Codes 111
Appendix 5: Differences between ABC 800 and ABC 802 113
Appendix 6: Differences between ABC 800 and ABC 806 129
19 Index 150
IV
1 BASIC - the Programming
Language
A formal language - a programming language - is used to give instructions to the
computer. The formal language consists of certain key words in English.
The name BASIC stands for Beginners' All-purpose Symbolic.lnstruction Code. BASIC
was originally designed for elementary programming education. However, the lan-
guage turned out to be so efficient that now it is used in a wide variety of
applications.
The concept behind many programming languages is that the whole program is fed to
the computer which translates it into the appropriate machine language; the program is
compiled. The compiler program looks for formal errors in the user program. The
computer then prints a list of the errors. The programmer corrects the program and
feeds it once more to the computer. The program is compiled and the errors - if any - will
be printed.
On the other hand, when you program in BASIC, a BASIC interpreter program is
resident in the computer. The interpreter checks every program line as soon as you have
written it. A formal error will result in an immediate error message on the screen. You
may run the program at any time to test the parts of it that you have written. This is
called interactive programming and is in many cases the most efficient way of
programming a computer.
Naturally, interactive programming does not solve all problems. When the formal errors
have been eliminated from the program, logical errors may still remain which can only
be detected when the program is executed with the proper data.
Like any other language, BASIC has grammatical rules. The grammar of a programming
language is much simpler than the corresponding rules of a natural language. The
example below shows a program which computes the mean value of five numbers,
given by the user. Here you can see the structure of the language.
Example
BASIC II contains all the elementary instructions needed for simple programs as well as
the instructions and functions which make possible the writing of more advanced
programs with greater efficiency. The key word in this kind of programming is efficiency.
As the programmer gains more experience, his efficiency increases and he will want to
use more advanced data processing. BASIC II is comprehensive enough to solve
virtually any problem.
BASI C II offers an AUTOSTART function, which is described in detail in the disk drive
manual.
2 The Program
A program consists of program lines containing statements. The statements contain
instructions for the BASIC interpreter. Every program line begins with a unique line
number. The line number is followed by one or more BASIC statements. Two
statements in the same line should be separatedbya colon (:).The line numbers indicate
the order of execution. Each statement begins with a key word, which indicates the
operation to be performed.
The statement gives an instruction to the computer (in this example PRINT):
The END statement, which tells the computer that the program is finished, is not
mandatory. The END statement should be the last instruction that is executed. When an
END statement is executed, all files are closed but the variables still have their current
values.
Every program line starts with a line number. Some of the effects of the line number are
given here:
1. Denotes the order of execution. The statements may be written in any order.
3. Makes it possible to alter (edit) any line without affecting the rest of the
program.
You, the programmer, chose the line numbers. Any integer from 1 up to and including
65 535 may be used.
Each line must have a unique line number. The computer uses the line numbers to
identify and keep track of the instructions. If a new line is written with an existing line
number, this new line will replace the existing one.
2
The statements may be entered in any order. The computer will arrange them by their
line numbers. If you write e.g. the lines 30, 10, 20 in that order, the computer will
rearrange them: 10, 20, 30.
The lines should be numbered by fives or tens so that new statements can be easily
inserted. There are commands for automatic line numbers (AUTO) and for renumbering
(REN).
2.2 Comments
A comment or remark can be denoted in two ways in BASIC II; by means of the
standard REM statements or with the text preceded by an exclamation point.
1. REM statement (according to the BASIC standards)
Remarks are part of a BASIC program. They are printed when the program is listed on
the screen or printer. These comments are not executed. Any character (except
RETURN) can be used in a remark. The remarks are usually marked with some clearly
visible character, so that you will notice them in the program.
NOTE:
The last statement will not be executed. The entire line is considered to be a
non-executable comment.
The line begins with a line number, then follows a BASIC statement. The key word of the
statement identifies the statement type. The BASIC interpreter is thereby informed as
to which operation to perform and how to treat the data - if any - that follow the key
word.
3
The user is allowed to write more than one BASIC statement on a single line. These
statements must be separated by a colon. A line consisting of several statements is
executed a little fasterthan the same statements if they are each written on one line. A
shorter execution time can be important in some applications.
is a "",111+1_11"10
IF-THEN
As a rule, any statement can be used anywhere in a multiple statement line. The
exceptions to the rule have been explicitly specified in the descriptions of the
instructions.
NOTE: It is good programming practice to write only one statement on each line.
2.4 Expressions
An expression is a group of symbols that represent constants, variables, functions or a
combination of these separated by arithmetic, relational or logical operators.
Examples:
Arithmetic expressions
4.123
3%+A%
B6*(C**3+1.0)
Relational expressions
x > V
V8 >=0
A=B
Logical expressions
Relational expressions yield a truth orfalse value that reflects the result of a comparison
of two values.
Logical expressions yield a truth or false value that reflects the existance or
nonexistance of conditions.
4
2.5 Logical Units
BASIC II ensures independence from physical input/output devices through the use of
file numbers.The file number can be treated as a logical unit and is handled with the
instructions OPEN, PREPARE and CLOSE. Thefile number may for instance represent
a printer or a file on a tape cassette/flexible disk.
Example:
NOTE: CON: is the standard device. CON: stands for console (keyboard and
screen).
Some applications mavrequire that program execution continues after an error has
occurred. To accomplish this, the user can include an ON ERROR GOTO < line
number> statement in the program. The program will then jump to the user's error
handler which begins at the specified line number. The error handler will analyze the
error.
The ON ERROR GOTO statement should be placed before all the executable
statements, with which the error handling routine deals.
When an error occurs in a program, BASIC checks to see if the program has run through
an ON ERROR GOTO statement. If no such statement has been encountered, a
message is printed at the screen and the program execution is terminated. If an ON
ERROR GOTO statement was run through, program execution will continue at the line
number specified by that statement. The error handler at that line number can e.g. test
the function ERRCODE to find out precisely what error has occurred and decide what
action is to be taken.
If there are portions of the program in which any errors detected are to be processed by
the system and not by the error handler of the program, the error handler can be disabled
by executing the following statement:
The computer will then attend to all errors as it would do if no ON ERROR GOTO < line
number> had ever been executed.
5
The error handling routine is terminated by a RESUME statement. The function of
RESUME resembles the one of the RETURN statement at the end of an ordinary
subroutine. The program jumps to the entry point - if any - in the staternentthat caused
the error. If the program execution should continue at another line number, the line
number in question should be given in the RESUME statement.
6
3 Data
The range of values for floating point is the largest range of values in BASIC.
± 1E-38 ± 1E+38
There are seven significance digits in single (SINGLE) and sixteen digits in double
precision (DOUBLE). All numbers are rounded internally to fit this precision.
Numbers may be entered and displayed in three formats:
Integers
Character strings
NOTE
Strings used in string arithmetic have a maximum size of 125 characters including the
sign and the decimal point.
3.2 Constants
Numeric constants retain a constant value throughout a program. They can be positive
or negative. Numeric constants can be written as follows:
Example: +3%
-4.765
12345.6
-.0001
The three last constants of this example would be stored as floating point, since they
have no % suffix. The use of an explicit decimal point or percent sign is recommended in
all numeric constants to avoid unnecessary data conversion and to improve documen-
tation.
3.3 Variables
A variable is a data item the value of which can be changed during program execution. A
variable is denoted by a specific variable name.
7
Variable names consist of a single letter or a single letter followed by a single digit. It is
possible, by means of EXTEND, to use long variable names (letters and digits, starting
with a letter).
These characters are allowed:
A,B,C, ,Z (letters)
0,1,2, ,9 (digits)
A name can also have an FN prefix (denoting a function name), a . suffix (denoting
floating point), a % suffix (denoting integer), a $ suffix (denoting string), or a subscript
suffix that consists of a set of subscripts enclosed by parentheses.
Mixing of data types in a statement should be avoided. Use integers whenever possible.
Integers need less storage space and are processed faster by the computer.
The same name can appear in combination with various prefixes and suffixes in the
same program and generate mutually independent variables. For example, the floating
point variable A is entirely different from the integer variable A%. The name A can be
used as follows:
Variables are assigned values by LET, I NPUT, and READ among other statements. The
variables are set to zero before program execution, unless they have been protected by a
COMMO N statement. It is necessary to assign a value to a variable only when an initial
value other than zero is required.
8
3.4 Subscripted Variables and the DIM Statement
In addition to the simple variable, the use of subscripted variables (arrays) is allowed.
SUbscripted variables provide the programmer with additional computing capability for
dealing with lists, tables, matrices, or any set of related variables. Variables are allowed
with two numbers of subscripts.
A(O)
A(1)
A(2)
A(3)
A(4)
A(5)
Matrix structure
Subscripts used with subscripted variables may have integer values only. If a subscript
is a floating point value, it will be rounded off to an integer.
A dimension (DIM) statement is used to define the maximum subscripts of an array. If a
subscripted variable is used without a DIM statement, the maximum value of each
subscript is assumed to be 10. It is possible to change the minimum value for array
subscripts by means of the statement OPTION BASE. Normally, the minimum value is
Obut it can be changed to 1, so that a standard array would have 10 elements in each
dimension instead of 11. All DIM statements should be placed at the beginning of the
program.
9
3.5 File Storage
BASIC II provides facilities for the definition and manipulation of data on cassette or
disk.
A data file consists of a sequence of data items transmitted between a BASIC program
and an external input/output device. The external device can be a printer, a cassette, or
a disk. The OPEN statement specifies the devices available and their references. The
device has a name by which it is identified within the system (ORO: for disk drive
0).
Each data file is identified by a unique name; the file name. For example, ABC123.BAC
is the name of a disk file. The file is accessed internally in the user program by means of
its file number. The file number is given in the program by means of one of the
instructions PREPARE or OPEN. These statements will open the file, i.e. set up a
channel for the data transfer. To close such a data transfer channel the instruction
CLOSE is used. The instructions INPUT and PRINT or GET and PUT are used for the
data transfer.
A buffer area is created by the system when a file is opened. All data transfer to and from
a file is buffered.
To open an existing file the OPEN statement is used. If the file is new, it should be
opened with a PREPARE statement.
Example
opens the existing file named FILE1.AAA for input/output with file
numb-er 1.
The transfer of data takes place directly between the internal channel (the file number)
and the string variable or the value of the expression in question. All data transfer refers
to either one byte or one character string (the characters followed by a carriage
return).
INPUT £ reads a value to a variable or a string from the position of the file
pointer to a carriage return
INPUT LINE £ reads a value to a string variable including the carriage (CR) return
and line feed (LF)
GET £ COUNT reads one byte or the given number of bytes from the position of the
file pointer
PUT£ writes one record into the file
10
If no file number is given in the GET statement, it will attempt to read from the keyboard.
If the COUNT option is not used, GET will read one byte, i.e. one character.
Example
will read six characters from the file with file number 1 from the
position of the file pointer. The characters are put in the string
D2$.
The instruction POSIT is used to position the file pointer at the given position in the file.
The number of characters always refers to the beginning of the file (position 0). POSIT
can be used together with anyone of the other file handling instructions.
The function POSIT(file number) reads the position of the file pointer. In the example
above, POSIT( 1) has the value 8, when the example has been executed. POSIT returns
a floating point value, and can thus operate on long files.
WARNING POSIT should not be used in conjunction with sequential files, i.e.
files which are handled by PRINT and INPUT/INPUT LINE. If you
want to use POSIT with a sequential file, every PRINT statement
should be followed by a GET statement, else an end-of-file (EOF)
mark will be written at the position of the file pointer, the next time
that POSIT or CLOSE are used. A dummy GET looks like this:
40 GET £2,0$ COUNT 0
When POSIT is used with sequential files, you should look upon PRINT and GET as a
sequence of instructions that belong together.
The data transfer to or from a file will not be correctly terminated until the file is closed.
The contents of the buffer area are then transferred, and the file is given an end-of-file
(EOF) mark.
11
4 Integers and Floating Point
Numbers
Normally, all numeric values (variables and constants) specified in a BASIC program are
stored internally as floating point numbers. For integer numbers significant economies
in storage space can be achieved by the use of the integer data type. Also, integer
arithmetic is faster than floating point arithmetic. A constant, variable orfunction can be
specified as an integer by ending its name with the % character.
Example: A%, FNX%{Y), -8%, Z3%
The user always has to specify with the % character that an integer is to be generated,
otherwise a floating point value will be produced.
When raising to an integer power, the power value should be explicitly indicated as an
integer.
The computer will act as described above when BASIC II operates in its normal mode,
Le. FLOAT. The default value can be changed to integer by the INTEGER instruc-
tion.
When more than one operation is to be performed in a single formula, certain rules are
observed as to the precedence of the operators. The arithmetic operations are
performed in the following sequence, where the operation described in item 1 has
precedence:
1. Any formula within parentheses is evaluated first. The parenthesized quantity is then
used in further computations. Where the parentheses are nested as follows:
{A+{B* (C* * 3)))
the innermost parenthesized quantity is calculated first.
3. In the absence of parentheses, operations on the same level are performed left to
right, in the order that the formula was written.
12
4.2 Integer Arithmetic
All arithmetic with integer values is performed in modulo 2* * 16. A BASIC integer can
be between -32 768 and +32 767 inclusive. The integer representation can be
regarded as a continuous circle with -32 768 following +32 767.
Integer division forces truncation of any remainder. However, the function MOD makes
the remainder available.
Examples: 3%/40/0=0% and 283%/1000/0=2%
When an operation is performed on both integer and floating point data, the result is
stored in the format indicated by the resulting variable.
Example:
Any floating point variable that has an integer value, is automatically printed as an
integer but is internally still a floating point number.
If more than seven/sixteen digits are generated during any computation, the result will
automatically be printed in the format:
[-].nE[-]m
where n is a number with seven digits, at the most, and m is an exponent with one or two
digits.
Input allows all the formats used for output. When a floating point value is assigned to
an integer variable, the value is rounded off to an integer.
Example
Example
13
4.5 Integers as Logical Variables
Integer variables or integer valued expressions can be used within I F statements in any
place where a logical expression can appear. Any non-zero value is defined as being true
and an integer value of 0% corresponds to the logical false value. The logical operators
(AND, OR, NOT, XOR, IMP, EQV) operate on logical (or integer) data in a bitwise
manner.
NOTE:
The integer -1 % is normally used by the system for a true value. Logical values
generated by BASIC II always have the values -1 % (true) and 0% (false).
The truth table below is valid for the logical operations. A is the condition of one bit in
one integer value and B is the condition of the corresponding bit of another integer
value.
The result of a logical operation is an integer value generated by the combination of the
corresponding bits of two integer values according to the rules shown above.
The result of any logical operation can be assigned to an integer or a floating point
variable.
Example:
AND, OR, XOR, EQV, IMP, and NOT can operate on variables and valued expressions
to give a bitwise integer result. If logical operations are done on float variables or float
valued expressions, conversion to integer format is done before the execution of the
logical operation.
14
5 Character Strings
BASIC II not only processes numerical information but also information in the form of
character strings. A character string is a sequence of characters.
NOTE
The same name, without the $, denotes a numeric variable, which can be used in the
same program.
If less than 80 characters are used, the string length will be the default value of 80
characters.
15
Each string, scalar or vector element, has two lengths:
1. The maximum length is the number of bytes allocated to the strinq..
2. The current length is the number of bytes currently in use. The current length may
vary between zero and the maximum length. The current length is the only visible
length; this length may be examined by the function LEN.
If a string is assigned a null value (=""), the current length will be set to zero. No further
action is taken.
If a string is assigned a non-null value and has a non-zero max length, the string length is
checked. If the string length is sufficient, a nu mber of bytes will be allocated to store the
data and the current length will be set to the number of allocated bytes. If the string
length is not sufficient, an error message will be written.
Example
is the same as
INPUT LINE is very useful for string input. It accepts one line from the keyboard.
Example
16
Example
The INPUT statement is used to input character strings exactly as though accepting
numeric values.
Example
Example
When line 15 is executed, the following will occur: A$(I%) and A$(I%+ 1%) are
compared; if A$(I%) occurs earlier in alphabetical order than A$(I%+ 1%), execution will
continue at line 11 5.
When two strings of unequal length are compared, the shorter string (length n) will be
compared to the first n characters of the longer string. If they are not equal, that
inequality serves as the result of the original comparison. If the first n characters of the
string are the same, the longer string is greater than the shorter one.
17
6 Working with BASIC II
The computer will always list the programs in its usual way independent of how the
statements were written.
NOTE
The spaces are significant in the following cases:
• EXTEND mode
• DATA statements
6.1.2 Procedure
A line can either be executed immediately (direct mode) or stored in the user program
area for later execution and eventually saved on an external device (disk or
cassette).
The RETURN key indicates that the statement is complete. If the statement contains an
error, an error message is written on the screen.
6.1.3 Corrections
The ~ key acts as a backspace key, deleting the immediately preceding character.
Typing this:
is equivalent to:
This line:
is equivalent to:
When a terminated line gives an error message, it can be edited using the arrow keys
(.... and~).
18
Example
This will result in::::::a:n::::::::e:r:~o::r::(::::th:e:§sag:e~::::::::::P:r~§s:::::::=:::::::::to display the characters and make
the necessary changes to the program line.
The ED command provides an ability to change characters after the line is
completed.
6.1.4 Deleting a Line
To delete the statement being typed, press the CTRL!X keys or the CE key. The entire
line being typed will then be deleted.
NOTE
To delete a previously typed statement, type the statement number and press the
RETURN key. The line with that number will then be deleted.
Example
(press RETURN)
One way of changing a program line is to retype it as it should be. The new line will
replace the old one when you press the RETURN key.
(press RETURN)
When editing a program you may want to tidy up the line numbering. This is done by
means of the RENUMBER command.
19
6.3 Executing a Program
The RUN command will start the execution of a program. When the command is
entered and terminated by the RETURN key, BASIC starts to execute the program in the
user program area at the lowest numbered line. Execution will continue until either one
of these conditions is encountered:
STOP
END
Error
When the program executes a STOP or END statement, it halts and all the variables still
keep their values. The user can examine the variables by simply addressing them by
their variable names.
Example: You want to know the values of the variables A, S, and K%. Enter
the following command:
(press RETURN)
The computer will then write the current values of the variables
when program execution was stopped.
Errors cause an error message to be written on the screen.
A running program can be halted by:
CTRL/C (both keys simultaneously)
20
To transfer data to and from the system:
Use the instructions INPUT, INPUT LINE, PRINT, GET, PUT,
PREPARE, OPEN, and CLOSE. Use OUT and INP to control
input/output via the inports/outports of the ABC 800.
2. Conditional branch
Use the instructions IF-THEN, ON ...-, and WHILE-WEND.
3. Program loops
Use the instructions FOR-NEXT.
Chapter 10 contains the many mathematical, logical and other functions available,
which extend user programming and provide it with advanced features.
21
6.5 Declarations
There are the following declarations:
• FLOAT/INTEGER
• SINGLE/DOUBLE
• NO EXTEND/EXTEND
If any declaration statements are used, they should be placed at the very beginning of
the program. COMMON and DIM statements, if any, should follow directly after the
declarations.
22
7 Direct Mode
BASIC II facilitates computer utilization for the immediate solution of such problems,
generally mathematical ones, which do not require iterative program procedures.
When BASIC II is in the command mode, a BASIC statement may be entered without a
line number. Such a statement, when terminated by RETURN, will be executed
immediately. This is called the direct mode of execution.
Most BASIC statements can be used in direct mode.
Example:
Statements which are entered with line numbers are considered to be program lines
which will be executed later.
23
8 Commands
When a command is written and terminated by RETURN it causes BASIC to take
immediate action. A BASIC program, by contrast, is first entered into the memory and
then executed later, when the RUN command is given.
When the BASIC interpretor is ready to receive a command, the text ABC 800 is
displayed on the screen. Commands should be typed without any line numbers.
Different commands control the editing and execution of programs and allow file
manipulation. Each command is identified by a key word at the beginning of the
line.
Generally:
'BC 802,806 .the devices are addressed as ORO:, DR1:, CAS:, PR:, and CON:.
• the primary default device is disk drive 0 (ORO:) and the secondary one is disk drive 1
(DR1 .), If both a disk drive and a cassette recorder are connected, the device CAS:
must be given if a command is to act on the cassette recorder.
• a file name should consist of up to eight alphanumeric characters, the first of which is a
letter. In addition, an extension (3 characters) may be used to clarify the file
name.
• the extension of a file name need not be given explicitly. However, there are some
exceptions. All such exceptions are mentioned in the syntax rules. If no extension is
given, the command will act first on files with the extension. BAC and then on files with
the extension .BAS.
The following list shows the commands with a short description of each one:
24
CLEAR Clears all variables and closes all files.
AUTO
Function The new line number is automatically entered after each carriage
return. You do not have to enter the line numbers manually.
25
Example AUTO 10,5
The first line number will be 10 and the line number will be
incremented by 5 for each line.
etc
BYE
Format BYE
Action Closes any files remaining open and loads the command interpre-
ter CMDINT.SYS.
$BAS
Format $BAS
Action Terminates the DOS work and transfers control to the BASIC
interpreter.
CLEAR
Format CLEAR
CONTINUE
Note CON cannot be used if the program has been edited or an error has
occurred.
26
ED
Action When the command has been terminated by the RETURN key, the
....·is used to display the contents of the line. Each time the -.. key
is pressed, one character is displayed. If you want to alter the
contents write the new characters where they should be. Use the
..-key to back space.
The second line will thus show your new text. Erase C by pressing
·"-once. Type D. The bottom line now looks like this:
27
ERASE
Format ERASE line number I [- line number II]
ERASE line number -
ERASE - line number
Function Erases one or more program lines.
Action All lines between line number I and line number II inclusive are
removed.
LIST
Format LIST [device:]file name[.extension][,line number[-line number]]
LIST [device:][,line number[-line number]]
LIST line number -
LIST - line number
2. LIST
The entire program is listed on the screen.
5. LIST PR:
The entire program is listed on the printer.
ABCB02 Note A long program is listed on the screen until it is filled. The next line
will be displayed when you press the space bar. A listing can be
stopped by CTRL/C, RETURN or any BASIC command.
28
Examples Stores the file ABC800 on external storage
Lists the entire program on the screen
Lists line 100
Lists the lines 100-500
Lists the entire program on the printer
Lists the lines 100-200 on the printer
LOAD
Format LOAD [device:]file name[.extension]
Where <file name.extension» is the name of the program to be
loaded. < Device> can be CAS:, DRO: or DR1:.
Function Loads a BASIC program into the working storage of the computer
from an external storage.
Examples
Note If no extension is given, the computer will first search for .BAC and ABCB02
then .BAS. The entire file is read, until EOF(end of file) and not only
to the END.
MERGE
Function Merges program files so that the program lines will be in line
number sequence. The program from the external storage overlays
the current program.
Action The numbered BASIC lines from thefile specified are inserted in
line number sequence in the current program. Each new line is
checked for errors. If a new line has the same number as an old one,
the old line is replaced by the new one.
29
The following program file is stored on an external storage (disk or
cassette) under the name TABLE:
The command MERGE adds the lines 200, 300 and 999 to the
existing program.
NEW
Format NEW
Action Clears the working storage and all variables and resets the pointers.
The command erases all traces of the existing program from the
storage and starts over again.
Note The command SCR (scratch) can be used, as well.lt works just like
NEW.
RENUMBER
REN
< From line> - <to line> specify which lines are to be renumbered.
The default is that all the lines are renumbered.
If you want to specify < interval>, < line number> must be speci -
fied.
If you want to specify <from line> - <to line>, you have to
specify both < line number> and < interval>.
30
Action All the line numbers of the program are changed as specified in the
RENUMBER command.
Examples
RUN
Action 1. RUN
All variables and arrays in the program area are erased and all
buffers are cleared. The execution of the current program is started
at the lowest numbered line.
Example 2
If the same program had been stored on an external storage under
the name AADDB, the screen would look like this:
31
SAVE
Function Creates a program file on an external storage and stores the current
program on that file.
Example
ABCB02 Note If the file exists already on the disk, the old file will be destroyed and
replaced by the new program, unless the file or the disk is write
protected.
SCR
Format SCR
Action Clears the working storage and all variables and resets the pointers.
The command erases all traces of the existing program from the
storage and starts over again.
Note The command NEW can be used, as well.lt works just like
SCR.
UNSAVE
Format lI\ISAVE [device:]file name[.extension]
Example When you have completed all work with the file XYZ, the file can be
erased by the following command:
ABCB02 Note When the extension is omitted, the computer will look for .BAC first
and then .BAS.
The command UNSAVE cannot be used on an erase protected
file.
32
9 Instructions
This chapter describes the program statements of BASIC II. A program statement is an
instruction, which tells the BASIC interpreter to perform a certain operation. Most
instructions can also be used as commands.
33
NEXT Increments the variable in a FOR loop
PREPARE-AS
FILE Creates and opens a new file and assigns a file number
PRINT
PRINT USING Prints data with the specified format
RANDOMIZE Provides a new initial value for the random number generator
34
CHAIN
Format CHAIN "file name.extension"/string variable
Where <file narne.extension » is the name of the program to be
loaded. If the file name refers to a disk file and no extension is given,
the computer will search for .BAC and secondly .BAS.
Use If the program is too large to be loaded into the computer storage
and run in one operation the program can be segmented into
several programs. The CHAIN instruction is used as a logical
termination of one program to call the next one. Each program is
called by its name. The program in the computer is erased and the
new one is loaded. The lowest numbered program line is executed
first as though a RUN command had been used. The CHAIN
instruction is the last instruction to be executed. The last program
in a chain does not need any CHAIN statement, but control is often
transferred by CHAIN back to a program that allows the user to
select the program to be run.
Example
CLOSE
Format CLOSE [file number, ...]
< File number> specifies the file to be closed.
Use The instruction CLOSE is used to close one or more files. If no file
number is given, all files will be closed.
COMMON
Use ,The declarations must look alike in all programs. The programs
must be alike regarding precision and integers or floating point
values.
35
Note The length of common string variables must be declared. The
COMMON statements must follow immediately after the decla-
ration statements.
Example
DATA
Use DATA is used only in conjunction with READ and vice versa. See
READ.
Example
DEF FN
Format Single line function:
DEF FN identifier[(argument)]=function
Use A multiple line DEF function differs from the single line functions
due to the absence of an equal sign following the function
designation on the first line. Any number of arguments of any type
or any mixture of types may be used. Within the multiple line
function definition there must be a statement of the form:
RETURN expression
FNEND
36
DEFFN
Note ON ERROR GOTO line number, GOSUB line number, and
RESUME line number may only call lines within the function.
Only RESTORE to data statements is allowed to point on lines
outside the function.
Any variable referred to in the body of a function definition which is not an argument or a
local variable of that multiple line DEF function keeps its value in the calling program.
Multiple line DEF functions can be nested; one multiple line function definition can refer
to itself or another multiple line function definition. The same rules apply here as for the
nesting of program loops. There must be no transfer from within the definition to outside
its boundaries or from outside the definition into it. The line numbers used by the
definition must not be referred to elsewhere in the program. If ON ERROR GOTO is
used inside the function it will be disabled as the function exits to the calling
program.
If temporary variables are needed within a function definition they should be declared
local to the function in order to protect the global variables from being disturbed. This
eliminates the need for variable names that are free for usage.
The LOCAL modifier makes possible the local variable name option. Vectors cannot be
declared LOCAL and string variables must have explicit length.
37
The next example shows a string function:
FNEND
Format FNEND
Note This statement must not be executed. The function shall exit by a
RETURN. statement before FNEND is encountered.
DIGITS
Note The DIGITS instruction does not affect the accuracy of calcula-
tion.
38
DIM
Function Gives the maximum number of elements and allocates space for
strings and vectors.
Use Any number of indices is allowed both for scalar and vector
variables. All values used in DIM statements are rounded off to
integers. If a subscripted value is used without a DIM statement it
is assumed to be dimensioned as 10 for each index. All variables
have a zero value until assigned a value. If a string variable has not
been dimensioned, its max length is automatically set to the current
length the first time that the string is assigned a non-null value
« > "").If less than 80 characters are used a standard length of 80
characters is assigned.
Advanced Programming:
The lower limit (0 or 1) indicated above can be overridden individually for each index.
This is done by replacing the single maximum index for each dimension by two values
separated by a colon.
Example
The example will yield a vector with five elements A(-2), A(-1), A(O), A(1), A(2) which
are totally independent of the current lower limit.
A dimensioned variable can be redimensioned only if the new DIM statement defines a
smaller dimension.
39
DOUBLE
Format DOUBLE
Function All variables and expressions with floating point numbers are
changed to double precision (1 6 digits).
Use The DOUBLE declaration should be placed before the variables are
used in the program and cannot be changed when the program has
been started by RUN. This change can be made when a program
line has been edited or the CLEAR command has been used. The
default precision is SINGLE.
END
Format END
Use The logically last instruction of a program. END closes all files.
EXTEND
Format EXTEND
Example
FLOAT
Format FLOAT
Function All variables are interpreted as floating point. Integers must have a
% suffix.
40
FOR
Format FOR variable-expression TO expression [STEP interval]
The expressions within the FO R loop are evaluated once, when the
loop is initially entered. The test for completion of the loop is made
prior to each execution of the loop.
Function The FOR and NEXT instructions are used together to create a
program loop. A loop means that one or more instructions are
executed a number of times.
The variable can be modified within the loop. When control falls
through the loop, the variable will have its new value, i.e. the last
value used plus the interval.
41
Example 1 The following is a demonstration of a FOR - NEXT loop. The loop is
executed 20 times. Before the exit from the loop A=20 is displayed.
The FOR statement contains no STEP interval so the interval is
assumed to be +1.
The loop consists of the lines 10, 20, and 30. When A% has the
value 20 and line 30 is executed, A% is incremented by 1 and line
10 is executed. Since A% is greater than the upper limit, line 10 will
cause control to be passed to line 40 which causes A=21 to be
displayed.
NEXT
GET
Function Reads one character from the keyboard into a string variable.
Note If the keyboard buffer is empty, the BAS IC interpreter will wait until
a key is pressed. Any character can be read.
42
GET£
< File number> is the file number defined by the OPEN instruc-
tion.
< String variable> is the string which receives the characterts),
COUNT < number of characters> denotes the number of charac-
ters to be read from the file.
Function Reads one or more characters from the specified file into the
specified string variable.
GOSUB
Example
Note The only instructions that may be used to exit a subroutine are
GOSUB or RETURN.
43
GOTO
Format GOTO line number
Where the < line number> is usually not the next sequential line
in the program.
Function Unconditional jump to the given line number.
Example
Note GOTO can be used in direct mode instead of CON if the execution
is to be resumed at a certain line.
IF - THEN - ELSE
44
The Relational Operators
= Equal
< > Not Equal
< Less Than
> Greater Than
<= Less Than or Equal
>= Greater Than or Equal
Example
The condition in line 200 applies both to the PRINT statement and
the assignment statement.
INPUT
Use During program execution, the user can type data when the
program asks for it. INPUT causes the computer to wait for an
answer. If no prompt text is given, a question mark is displayed on
the screen.
It is often convenient to display a prompt text to remind the user of
the kind of input data required. See Example 1 below. No question
mark is written after the prompt text.
45
Examples Example 1
is equivalent to
Example 2
Data will be read from file 3 and placed in the string C$.
INPUT LINE
Use The program accepts a line of characters from the specified file. All
characters belonging to the line are read; spaces, punctuation
characters, and quotes. The line termination characters carriage
return (CR) and line feed (LF) are read, as well.
Example 2
INTEGER
Format INTEGER
Function At data input and program listing, all variables are supposed to be
integer variables, unless otherwise declared.
46
Use When a program is being typed and the INTEGER instruction has
been given, the programmer need not type the integer suffix %. On
the other hand, all floating point variables should be marked by a
decimal point suffix (.). The strings should. have the usual $
suffix.
proqrarn.
Example
KILL
Where the file with the name <file name .extension » is not
delete-protected. The user cannot erase a delete-protected file.
Example When the file XYZ.TXT on the disk is no longer needed, the file can ABCB02
be erased from the disk by means of the following statement:
LET
Example
47
NAME
Example 2
The following statement:
changes the name of the file ABC.BAC on the disk in ORO:. The
instruction NAME - AS cannot transfer a file from one device to
another.
Example 3
NO TRACE
Format NO TRACE
Function Terminates the printout of line numbers, which was started by the
instruction TRACE.
Example
48
NO EXTEND
Format NO EXTEND
ON ERROR GOTO
ON - GOSUB
Example
49
ON - GOTO
Example
ON - RESTORE
Use The ON - RESTORE statement can thus be used to set the DATA
pointer to a specific position in the data buffer.
Example
50
ON - RESUME
Example
OPEN
Format OPEN "[device:][file name[.extension]]" AS FILE file number ABC 802, 806
Function Opens a file with a file number internal to the BAStC program.
The optional < file name.extension > is not used when opening the
printer.
Use OPEN is used to open files which already exist.
Data files or devices have both external names, by which they are
identified within the system, and file numbers, which refer to the
files within the program. The OPEN statement associates the
external file name with the internal file number.
Writing and reading from a file is done by means of instructions
such as INPUT, INPUT LINE, PRINT, GET, and PUT. .~...
Note When data is to be read from an existing file, the file should be ABC 802
opened by the OPEN instruction. Up to seven files may be open at
the same time.
51
Examples Example 1
Example 2
The values of the variables A, S, and C7$ are read from the file,
which was opened as file number 2. The values are read directly
after the values last read. If reading is to be done from the beginning
of the file, it must be opened again with the OPEN instruction.
OPTION BASE
Format OPTION BASE n
Where n = 0 or 1.
POSIT
Format POSIT £file number, position
Use POSIT is used to move the file pointer the specified number of
positions from the beginning of the file (the first position). The first
position = O. POSIT can be used together with all file handling
instructions. POSIT(file number) yields the current position of the
file pointer. See chapter 3.5.
Examples Example 1
52
PREPARE
Function Creates and opens a new file with an internal file number within the
current program.
Use PREPARE is used just like OPEN but will set up a new file. OPEN
is used for existing files.
Example ABCB02
Use The positions on a line are numbered from 0 to 39/79. The line is
subdivided into columns, fixed tabulator positions, starting in
positions 0, 15,30,45, 60, and 75. A comma (,) after a variable or a
string in the PRI NT list means that the next element of the list will
be printed in the next column. Two commas together in a PRINT
statement cause a column to be skipped.
When a line is filled, the printout continues on the next line. The
TAB and CUR functions are used to cause data to be printed in
certain positions.
53
$$ A double dollar character causes a dollar character to be printed to
the immediate left of the formatted number. The $$ specify two
more digit positions, one of which is the dollar character. The
exponential format cannot be used with $$. Negative numbers
cannot be used unless the minus sign is trailing.
56
The literal character itself may be an underscore if the format
string contains' "__".
% If the number to be printed is larger than the specified numeric field,
a percent character is printed before the number. A percent
character is printed also if rounding causes the number to exceed
the field.
PUT
RANDOMIZE
Format RANDOMIZE
Function Sets a random starting value for the RND function (the random
number generator).
READ
Format READ variable[, variable, ...]
57
If it is necessary to use the same data several times in a program,
the RESTORE or ON RESTORE instructions will set the data
pointer within the data block. See RESTORE and ON
RESTORE.
Examples Example 1
Example 2
REM
Example
RESTORE
58
Example 1
Sets the data pointer to the beginning of the first DATA statement
in the progra m.
Example 2
Sets the data pointer to the first data of the OATA statement with
line number 100.
RESUME
Format RESUME [line number]
Use When the error handling routine has been executed, you can
resume execution of the program by means of a RESUME
statement placed at the end of the error handling routine.
If execution is to be restarted at some other line in the program, the
line number should be indicated in the RESUME statement.
Example
Line 2000 returns control to the line that caused the error. Line
2010 returns to line 100.
RETURN
Format RETURN [variable]
SINGLE
Format SINGLE
Function Changes all variables and expressions, which are floating point
numbers, to single precision (7 digits).
Use The SINGLE declaration must be placed before the variables are
used and cannot be changed once the program has been started by
RUN. If a line is edited or the command CLEAR is given, SINGLE
may be changed to DOUBLE or vice versa. The default is
SINGLE.
59
STOP
Format STOP
TRACE
Format TRACE [£file number]
Example
WEND
Format WEND
60
WHILE
Format WH ILE expression
Function Specifies the condition for the branching out of a program loop.
Use In program loops where the values that determine the loop
termination are modified when the loop is executed. Compare FOR
loops, where the termination condition will be reached automati-
cally, no matter what the loop contains.
Example
Before the first execution of the loop and at the beginning of each
new execution the condition X< 10 is tested. The iteration will
continue for as long as this is true.
61
10 Functions
SIN{23*PI/180)
LOG(144)
62
ABS
Format ABS(argument)
Example
ATN
Format ATN(argument)
Example
cos
Format COS(argument)
Example
EXP
Format EXP(argument)
Example
FIX
Format FIX(argument)
Example
63
HEX$
Format HEX$(argument)
Example
INT
Format INT(argument)
Function The value of the greatest integer less than or equal to the argument.
Compare with FIX.
Use INT can be used to round off a number by means of INT(X+.5). The
INT function can be used to round off a number to any given
number of decimals using the formula:
INT(X*1 0**0%+.5)/1 0* *0%
where 0% is the required number of decimals.
If the number is negative, INT will return the largest integer less
than the argument.
Examples
LOG
Format LOG(argument)
Example
64
LOG10
Format LOG10(argument)
Example
MOD
Example
OCT$
Format OCT$(argument)
Example
PI
Format PI
Example
RND
Format RND
Examples Example 1
65
SGN
Format 5GN(argument)
Examples Example 1
Example 3
SIN
Format 51N(argument)
Example
SQR
Format 5QR(argument)
Example
TAN
Format TAN(argument)
Example
The result is Y=1
66
10.2 String Functions
Besides the intrinsic mathematical functions (e.g. SIN and LOG) various functions
operating on character strings are provided. These functions allow the program to
perform arithmetic operations on numeric strings, concatenate two strings, access part
of a strinq.deterrnine the number of characters in a string, generate the character string
which corresponds to a given number or vice versa.
ADDS
Format ADD$(A$,B$,[-] P%)
67
Note ASCII arithmetic calculations can operate on up to 125 charact-
ers.
ASCII
Format ASCII(A$)
Function Yields an integer equal to the ASCII value of the first character of
A$.
Example
Format CH R$(argument[,argument,...])
Example
Format COMP%(A$,B$)
Example
DIV$
Format DIV$(A$,B$,[-]P%)
68
INSTR
Format INSTR( N%,A$,B$)
Example
LEFT
Format LEFT($)(A$,I%)
Example
LEN
Format LEN(A$)
Function The number of characters of the string A$, Le. the string length
(including spaces).
Example
MID
Format MID[$](A$,P%,K%)
Function Assigns new values to the characters no.P% to Po/o+K%-1 in A$, Le.
exchanges the characters indicated in the string.
Example
69
MID
Format 1\11 D[$] (A$,P%,K%)
Function Gives the substring of A$, which starts at position P% and has a
length of K% characters, Le. the characters from no.P% to
Po/o+K%-1.
Example
MUL$
Format MUL$(A$,B$,[-]P%)
Example
NUM$
Format NUM$(argument)
Example
RIGHT
Format RIGHT[$](A$,N%)
Example
70
SPACES
Format SPACE$(N%)
Example'
spaces.
STRINGS
Format STRING$O%,K%)
Function Yields a string of 1% ASCII characters. The string has the length 1%
and consists of equal characters with ASCII value K%.
Example
SUBS
Format SUB$(A$,B$,[-JP%)
VAL
Format VAL(A$)
Function Calculates the numeric value of the numeric string A$. A numeric
string may contain digits, +, -, ., and E. The result is a floating point
number.
Example
71
A$+B$
Format A$+B$
Example
CVT%$(X%)
CVT$%(X$) Converts the variable from an integer into a string and vice
versa
CVTF$(X)
CVT$F(X$) Converts the variable from a floating point number into a string
and vice versa
FN User-defined function
PEEK2(1%) PEEK(I%)+256*PEEK(lO/o+1 %)
72
CALL
Format CALL(A%[,D%] )
CUR
Example
CVT
Use The CVT function is used to save disk space. Numeric values that
are stored on disk require as much space as when they are printed
by means of PRINT. Integers require up to six characters, floating
point numbers in single precision (81NGLE) twelve characters, and
floating point numbers in double precision (DOUBLE) require up to
twenty-two characters. Each character is stored in one byte. By
means of the CVT (from convert) function these data can be stored
a
in 2, 4, and bytes, respectively.
Examples
73
The example below shows how to store a floating point number.
The number may have either single or double precision:
The next example shows how to regain the number stored in the
example above:
ERRCODE
Format ERRCODE
Function Returns the value of the latest generated error code. If no error has
been indicated, the function value is O.
FN
INP
Format INP(I%)
CAUTION This function is machine oriented, and should only be used for
advanced programming.
74
OUT
Format OUT port,data [,port,data, ... ]
where the port numbers and the data are given as decimal
numbers.
Note The I/O channel is selected by means of the OUT instruction. That
channel will remain accessible until a new selection is made by
means of OUT.
PEEK
Format PEEK(I%)
PEEK2
Format PEEK2(BO%)
POKE
Format POKE address,data [,data, ...]
75
SWAP%
Format SWAP%(N%)
SYS
Format SYS(I%)
Example
TAB
Format TAB(I%)
Example
TIME$
Format TIME$
....
!\\\\\:;i·;\'
......... :,
: i,:):;::::::(: : ....:
".:.
.. :):::::::::,:::{'i/(:
:
...):t:
76
VAROOT
Format VAROOT (variable)
VARPTR
Format VARPTR (variable)
10.4 ABCB02
77
IBC802,B06 11 Graphics and Colours
When text or graphics are displayed on the screen, the selection of colours etc. is
controlled by means of certain arguments in the PRINT statement. The statement
affects one line at a time. Each argument puts a control character on the screen.
Although these characters are invisible, they take up one position each. The control
characters can be covered by a background colour, if the control arguments are given in
the correct order.
Red (RED)
Green (GRN)
Yellow (VEL)
Blue (BLU)
Magenta (MAG)
Cyanide (eVA)
White (WHT)
The characthers available in the ABC 800 are listed below. The table gives the ASCII
value of each character and its meaning in the character mode and graphic mode. One
way of planning a graphical picture is to draw it on a copy of the graphics chart and feed
the program the appropriate data.
When you have finished the picture on a copy of the chart you can type the lines one by
one. Do not forget to allow space for the control characters, if you vary the control
arguments.
Note that the capital letters still remain the same in graphic mode. You can mix capital
letters and graphic characters just as you like.
In graphic mode there are 72 graphic lines (0-71), each one with 78 graphic positions
(0-77).
78
A C A C A C A C
32 Space 56 8 80 P 104 h
33 I 57 9 81 Q 105 i
34 " 58 : 82 R 106 j
35 et 59 ; 83 S 107 k
36 $ 60 < 84 T 108 l
37 0/0 61 = 85 U 109 m
38 & 62 > 86 V 110 n
39 63 ? 87 W 111 0
40 ( 64 @ 88 X 112 P
41 ) 65 A 89 Y 113 q
42 • 66 B 90 Z 114 r
43 + 67 C 91 [ 115 s
44 68 0 92 \ 116 t
45 - -69 E 93 ] 117 u
46 70 F 94 .-... 118 v
47 / 71 G 95 - 119 w
48 0 72 H 96 \
120 x
49 1 73 I 97 a 121 y
50 2 74 J 98 b 122 z
51 3 75 K 99 c 123 {
52 4 76 L 100 d 124 I
53 5 77 M 101 e 125 }
54 6 '78 N ,102 f 126 -*
55 7 79 0 103 g 127
• *) Not generated from key-
board
A C G A C G A C G A C G
32 Space D 56 8 ~ 80 P P 104 h [j
33 ! r 57 9 ~ 81 Q Q 105 I II
34 " [j 58 : ~ 82 R R 106 j [I
35 ,t U 59 ; ~ 83 S S 107 k ~
36 $ ~ 60 < ~ 84 T T 108 l ~
37 0/0 ~ 61 = 13 85 U U 109 m ~
38 & ~ 62 > ~ 86 V V 110 n ~
39
40
41
42 •
(
)
~
G
~
~
63
64
65
66
?
@
A
B
~
@
A
B
87
88
89
90
W
X
Y
.. .
Z
W
X
y
Z
111
112
113
114
0
p
q --..'.1.
~
. ,
-
r
43 + ~ 67 C C 91 115 s
44
45
46
-
~
~
~
68
69
70
0
E
F
0
E
F
92
93
94
..
1/2 1/2
t
•
t
116
117
118
t
u
v
~
L
I:
47
48
49
0
1
/ ~
~
~
71
72
73
G
H
I
G
H
I
95
96
97
#
-
Q
#
Q
~
119
120
121
w
x
y
.
~
~
50 2 ~ 74 J J 98 b c= 122 z ~
51 3 ~ 75 K K 99 c ~ 123 1/4 :I
52
53
4
5
iJ
IJ
76
77
L
M
L
M
100
101
d
e
~
~
124
125
II
3/4
•II
S4 6 ij 78 N N 102 f ~ 126 --7-*11
55 7 ~ 79 0 0 103 g ~ 127
• I *) Not generated from key-
board
ASCII codes (A) for character mode (C) and graphic mode (G).
79
11~t8oo VIDEO GRAPHICS CHART PROGRAM .
(X)
70
71 f-'-'~-'"
01 69 ~~~~ t~,
o ::::::::
"1:;;;1:;:;:1
1167 :::: ::::::
66 ::::::::::
15
1::::1:::::
2\64 :::::::::,
63 x-:.:.:
62
31 61 1;';'1
:~:~ ;';"
:~:~:
60 :::::::::
5!rID"' ;o;o·
41 58 :~:~ :~:~:
57 ::::.:::::
56 ~;';'I';';'
51-55 ::::::::::
54 :::::::::'
53' l::::I;:::::'
6152 :::::::::,1
51 :::: :::::
50 :::: :::::
7 49 .:.:.:.:.. .
48 :::: :::::
8 :: ~i~i ~i~i~
44 -~;~::m·::;:
U
9143 ::::::::::
42 ':::::::::
4Jl ~-.-.~-.-.
1 0 I 40 ~~~~ ~t
39 ::::.:::::
i!
111 tI[~i
1 21 351°;O;w····
34 ~:~: ~:~:~
33 :::::::::
32 I::::.~:::::
13131 ::::::::::
30 ::::::::::
29 ~';';l;';"
14\ 28 ~:~: :~:~:
27 ::::::::::1
1 51 ~i ~f[!i!
1 61 ~~ lii!1iii
17 !i i!{f
18 ~ i ~f :! !i~
14 I::::
1 91 13 ~:~:~:::::
12 ....:t•••
~,
2 21; ~! ! l! !~!
ABC 806
PRINT ABC 802, 80E
Function Used for printing text and graphics. The arguments control the
colour selection etc. A G at the beginning of the colour selection
argument (e.g. GRED) sets the line to the graphic mode so that all
characters within quotes are interpreted as being graphics (see the
ASCII table). If CUR(L,N) is specified, the picture is drawn from the
starting point at line L (0-23), position N (0-39/79).
RED,GRN,YEL,BLU,
MAG,CYA,WHT Alphanumeric colour characters
GRED,GGRN,GYEL,GBLU,GMAG,
GCYA,GWTH Colour graphics
Example
81
Example
The lines 10 - 40 clear the screen and set it to the graphic mode
(green). The lines 50 - 70 draw a sine curve. Line 80 displays SINE
in red, flashing and with double height.
TXPOINT can be used as a function, too, to check if a point is
turned on (-1) or off (0). TXPOINT(X,Y).
Note The origin is in the lower, left-hand corner.
ABCB02
SET DOT
Format SET DOT L%,N%
Function Turns on the graphic point in position L%, N%, where Lo/o=O-71 and
No/o=2-79.
CLR DOT
Function Turns off the graphic point in position L%, N%, where Lo/o=O-71 and
No/o=2-79.
DOT
Format DOT(L%,N%)
Function Will be -1 (true) if the point is lit, else 0 (false). Lo/o=line (0-71),
No/o=position (2-79)
82
12 High Resolution Graphics ABC 802, 806
High resolution graphics, which is an option, can be used with the ABC 800 C as well as
with the ABC 800 M.
The screen is subdivided into 240 x 240 picture elements (pixels). Each pixel can be
addressed directly and is independent of the others. Two data bits correspond to each
pixel. The data bits are used to select one of four colours. High resolution graphics can
be shown together with the usual text or graphics display. The origin of the picture is in
the lower left-hand corner and the positions are numbered from 0 to 239.
239 ---
I
I
y
I
o __
o x 239
The screen is adjusted to obtain the following relations between height and width:
83
ABCB06 12.2 Instructions
• The colour number is a digit from 0 to 3, where 0 indicates the background colour.
The meaning of the digit is listed in the colour selection table (chapter 12.4)
• The colour number is optional. If no colour number is given, the previous colour
number will be used.
• The starting position of the picture is selected by means of OUT 6,line number,
where line number is in the interval 0 - 255.
FGCTL
Format FGCTL colour selection command
Function Fills a rectangle from the previous position to the position indicated
by the coordinates (x,y).
FGLINE
Format FGLINE x,y[,colour number]
Function Draws a line from the previous position to the position indicated by
the coordinates (x.v),
FGPAINT
FGPAINT x,y
This area will not be filled
84
FGPOINT
FGPOINT
1. Pick out a colour selection group (72-127, 200-255). The colour selection groups
are used two and two together e.g. 72-73, 74-75 .
2. Draw a picture with colour number 1 or 2. Select the same colour as the one the
picture is drawn on. The picture cannot be seen.
3. Change the colour selection group so that the picture that was drawn in point 2
above becomes visible.
5. Change the colour selection group so that the picture that was drawn in point 2
disappears and the one drawn in point 4 will show.
7. Change the colour selection group so that the picture drawn in point 6 becomes
visible.
To protect the current picture until a new picture is to be shown use the following
method:
This instruction will cause a line to be drawn from the previous position to the point
100,100 with colour number 1. Colour number 2 is protected and will not be
changed.
85
ABCB06 12.4 Colour Selection Table
The colour selection command (according to the table below) is in the interval 0-255.
Values less than 128 mean that the ordinary text and graphics are displayed on top of
the high resolution graphics. From 128 upwards the high resolution graphics memory is
displayed. The values from 72 to 127 and 200 to 255 are used in animation mode (see
above).
0 BK BK BK BK 128
1 BK W W W 129
2 BK R GR Y 130
3 BK R GR B 131
4 BK R GR M 132
5 BK R GR C 133
6 BK R GR W 134
7 BK R Y B 135
8 BK R Y M 136
9 BK R Y C 137
10 BK R .Y W 138
11 BK R B M 139
12 BK R B C 140
13 BK R B W 141
14 BK R M C 142
15 BK R M W 143
16 BK R C W 144
17 BK GR Y B 145
18 BK GR Y M 146
19 BK GR Y C 147
20 BK GR Y W 148
21 BK GR B M 149
22 BK GR B C 150
23 BK GR B W 151
24 BK GR M C 152
25 BK GR M W 153
26 BK GR BK W 154
27 BK Y B M 155
28 BK Y B C 156
29 BK Y B W 157
30 BK Y M C 158
31 BK Y M W 159
32 BK Y C W 160
33 BK B M C 161
86
Selection Colour Selection
command 0 1 2 3 command
Graphics + Graphics
text only
34 BK B M W 162
35 BK B C W 163
36 BK M C W 164
37 R GR y B 165
38 R GR y M 166
39 R GR y C 167
40 R GR y W 168
41 R GR B M 169
42 R GR B C 170
43 R GR B W 171
44 R GR M C 172
45 R GR M W 173
46 R GR C W 174
47 R Y B M 175
48 R Y B C 176
49 R Y B W 177
50 R Y M C 178
51 R Y M W 179
52 R Y C W 180
53 R B M C 181
54 R B M W 182
55 R B C W 183
56 R M C W 184
57 GR y B M 185
58 GR y B C 186
59 GR y B W 187
60 GR y M C 188
61 GR y M W 189
62 GR y C W 190
63 GR B M C 191
64 GR B M W 192
65 GR B C W 193
66 GR M C W 194
67 y B M C 195
68 y B M W 196
69 y B C W 197
70 Y M C W 198
71 B M C W 199
72 BK R BK R 200
73 BK BK R R 201
74 BK GR BK GR 202
75 BK BK GR GR 203
76 BK Y BK Y 204
77 BK BK Y Y 205
78 BK B BK B 206
79 BK BK B B 207
80 BK M BK M 208
81 BK BK M M 209
82 BK C BK C 210
83 BK BK C C 211
84 BK W BK W 212
87
Selection Colour Selection
command 0 1 2 3 command
Graphics + Graphics
text only
85 BK BK W W 213
86 R GR R GR 214
87 R R GR GR 215
88 R Y R Y 216
89 R R Y Y 217
90 R B R B 218
91 R R B B 219
92 R M R M 220
93 R R M M 221
94 R C R C 222
95 R R C C 223
96 R W R W 224
97 R R W W 225
98 GR y GR y 226
99 GR GR y y 227
100 GR B GR B 228
101 GR GR B B 229
102 GR M GR M 230
103 GR GR M M 231
104 GR C GR C 232
105 GR GR C C 233
106 GR W GR W 234
107 GR GR W W 235
108 Y B Y B 236
109 Y Y B B 237
110 Y M Y M 238
111 Y Y M M 239
112 Y C y C 240
113 Y Y C C 241
114 Y W Y W 242
115 Y Y W W 243
116 B M B M 244
117 B B M M 245
118 B C B C 246
119 B B C C 247
120 B W B W 248
121 B B W W 249
122 M C M C 250
123 M M C C 251
124 M W M W 252
125 M M W W 253
126 C W C W 254
127 C C W W 255
88
12.5 Examples ABCB06
Example 1
Example 2
89
ABC802,806 13 Function Keys
The computer has eight function keys that are situated between the alphanumeric and
the numeric keys. The function keys are labelled PF1, PF2, ..., PF8.
A programmer can assign various functions to the function keys, e.g.cursor movements
or a jump to a program module.
The function keys can produce 32 different ASCII values as shown in the following
table:
Example:
When a function key is pressed at INPUT or INPUT LINE, an error is generated. The
ERRCODE is 53. The program should contain a routine which handles error 53. To find
out which one of the function keys that was pressed, use the function SVS(6) and read
the character by means of GET.
90
14 Differences in BASIC between
ABC 800 and ABC 80 ABCB06
The changes, which have been made in relation to the ABC 80 BASIC, are adjustments
to the ANSI standards. The memory mapping and the internal code have also been
changed.
1. When an integer variable is assigned a floating point value, the value will be
rounded off.
Example:
!1~~lnnort the value:
ABC 80: 3
ABC 800: 4
2. When TAB is used for printouts, the printing position is specified starting at
TAB(1).
Example:
is printed at position 6 (i.e. the positions are 0-39)
ABC 800: B is printed at position 5 (i.e, the positions are
1-40/80)
3. When the value of a variable is printed using N UM$, the position which was meant
for the + sion is no loncer used.
Example:
ABC 80:00
ABC 800:0 0
5. The CALL instructions for file access are replaced by POSIT, GET - COUNT, and
PUT.
Example: Reading
ABC 80:
Z=CALL(28666,file number)+CALL(28668,sector number)
ABC 800:
POSIT £file number,sector number*253 : GET£file number,
00$ COUNT 253
Writing
ABC 80:
Z=CALL(28666,file number) : OO$=A$ : Z=CALL(28670,sector
number)
ABC 800:
POSIT £file number,sector number*253: PUT £file number,A$
6. The CHAIN"" instruction is removed or changed to END in ABC 800 programs. ABCB02
7. The END instruction should be the only instruction on the line. END closes all files
but does not clear the variables.
8. The instruction JON ERROR GOTO replaces ON ERROR GOTO O.
9. An ABC 80 program can be tranformed to ABC 800 if it is stored in text format
(.BAS) i.e. by means of the LIST <file name> command, The lines which are
incompatible will cause error messages. A question mark following the line number
will indicate such a line.
91
15 Error Messages
Error no. 19-68: I/O errors
Error no. 120-129: ISAM errors
Error no. 130-176: Errors during program execution
Error no. 180-191: Logical errors
Error no. 200-211 : General errors
Error no. 220-234: Formal BASIC errors
92
Error Message Comment
93
Error Message Comment
94
16 Summary of Commands and
Instructions
95
CLEAR (command) Page 26
Format CLEAR
Function Clears all variables and closes all open files.
96
DIGITS (instruction) Page 38
Format DIGITS number of digits
Function Gives the number of digits to be printed.
ED (command) Page 27
Format ED [line number]
Function Starts program editing.
97
ABC 802 FGFILL (instruction - high res. graphics) Page 84
Format FGFILL x,y[,colour number]
Function Fills a rectangle from the previous position to the position
indicated by the coordinates (x,y).
Note The origin is at the lower left-hand corner.
FN (function) Page 74
Format FNidentifier[%/$] [(parameter [,parameter, ...])]
Function Calls a user-defined function.
Note Compare with DEF FN.
98
GOSUB (instruction) Page 43
Format GOSUB line number
Function Unconditional jump to a subroutine.
99
LEN (function) Page 69
Format LEN(A$)
Function The number of characters of the string A$, i.e. the string length
(including spaces).
100
NAME (instruction) Page 48
Format NAME "[device:]file name1.extension" AS "file name2.exten-
sion"
Function Changes the name of a file.
ON ERROR
GOTO (instruction) Page 49
Format ON ERROR GOTO fline numberl
ON-
RESTORE (instruction) Page 50
Format ON expression RESTORE line number[,line number,...]
Function Sets the DATA pointer by the same selection routine as
ON - GOTO.
101
ON - RESUME (instruction) Page 51
Format ON expression RESUME line number[,line number,...]
Function Jump to one of several line numbers, depending on the value
of the expression. Error handling is resumed. Used with
ON ERROR GOTO.
OPTION
BASE (instruction) Page 52
Format OPTION BASE n
Function Denotes the lowest vector index value (11=0 or 1).
PI (function) Page 65
Format PI
Function Constant with the value 3.141 59 (single precision)
102
PRINT (instruction) Page 53
Format PRINT [£file number,] "data"/variable [,"data"/variable, ...]
Function Prints data on an ASCII format.
103
RETURN (instruction) Page 59
Format RETURN [variable]
Function Return from subroutine or multiple line function.
104
STOP (instruction) Page 60
Format STOP
Function .Stops the program execution.
Note The program execution can be continued by one of the
commands CON or GOTO.
105
UNSAVE (command) Page 32
Format UNSAVE [device:]file name[.extension]
Function Erases a file from a disk.
106
17 Literature References
• "ABC's of BASIC" by Anders Andersson, Arne Kullbjer, Jan Lundgren and Soren
Thornell.
An introduction to ABC 80 BASIC.
Books about the ABC 800, BASIC II and programming will be issued from time to
time during 1981.
107
18 Appendices
Port Address
bit bit
7 0
X = don't care
108
Appendix 3: Storage Disposition ABC 802, 806
SIMPLE VARIABLES
65280 FFOOH 377:000
CASBUF2
65024 FEOOH 376:000
CASBUFl
64768 FDOOH 375:000
32 KB RAM
WORKING STORAGE
16384 ,------
I
4000H 100:000
1 16 KB RAM
IGRAPHICS2
1
I
I
I
1. ABC 800 C uses only 1 kB CRT text display storage (31744 -32786).
2. The CRT text display storage (2 kB) on the VU board is parallel with the graphics
system program (2 kB) on the PU board. Likewise, the CRT graphics display storage
(16 kB) is parallel with the system program for BASIC. The different areas of the
memory do not interact. ABC 800 runs in a special mode when the graphics storage
is addressed. If storage space for machine language routines is to be allocated, the
following addresses are changed:
• The pointer for the lowest memory address of a BASIC program (BOTTOM):
65292
• The pointer for the highest memory address of a BASIC program (TOP):
65294
109
ABC 800 Memory Map with Disk Drives.
STACK
32 KB RAM
WORKING STORAGE
163 84 ,------
I
- 4000H 100:000
I 16 KB RAM
I GRAPHICS2
I
I
I
I _I
-
110
Appendix 4: Keyboard Layout, ASCII Codes ABC 802, 806
CDCDrnrnrnrnGJrnCDCDCDffiO 88 0(!J[!JG
~ @J §J ® @ W0 @] OJ @] 0 @ CD (RETURN) 88 0~0G
80@]@J(£J@]CBJ0@[gITDGJGJ8 BB CD0@]m
800@J0~@~OO(I)EJG 88 ( 0 )OW
( )
Viewdata keyboard
CDCDrnrnrnrnG]rnCD5J8EJCD 88 0(!J[!JG
~@J §J ® @ W0 @] OJ @] 0 GJ CO (RETURN] 88 0~0G
80@]@J(£J@]CBJ0@[gCDCDGJ8 BB CD0@][U
EJ00@J0~@~[JLJCDEJG 88 ( 0 )0 ~
( ]
Typewriter keyboard
111
A C
32 Space
A
56
C
8
A
80
C
P
A
104
C
h
A
32
C
Space
G
D
A
56
C
8
G
~
A
80
C
P
G
P
A
104
C
h
[, G
~ ~
,f.
~
33 I 57 9 81 Q 105 i 33 I 57 9 81 Q Q 105 1
34 58 82 R 106 j 34 . [j 58 ~ 82 R R 106 J
35 ri 59 ; 83 S 107 k 35 .t ~ 59 ; ~ 83 S S 107 k
36 $ 60 < 84 T 108 I 36 $ ~ 60 < i3 84 T T 108 l ill
37 0/0 61 = 85 U 109 m 37 0/0 ~ 61 = ~ 85 U U 109 m !'Ii
38 & 62 > 86 V 110 n 38 & ~ 62 ~ 86 V V 110 n it
•
>
39 ~ ~
·--.
63 7 87 W 111 39 63 87
0 ? W W 111 a
40 ( 64 @ 88 X 112 P 40 ( G 64 @ @ 88 X X 112 P
41
.
) 65 A 89 y 113 q 41
.
) ~ 65 A A 89 Y
..
Y 113 q
-
-
·
42 66 B 90 Z 114 r 42 ~ 66 B B 90 Z Z 114 r
43 + 67 C 91 [ 115 s 43 + ~ 67 C ( 91 115 s
44
45
46
-
68
69
70
0
E
F
92
93
94
\
-- l
116
117
118
t
u
v
44
45
46
-
~
~
~
68
69
70
D
E
F
0
E
F
92
93
94
..
1/2 1/2
t t
116
117
118
t
u
v
II.
L
.:
47
48
/
0
71
72
G
H
95
96 \
119
120
w
x
47
48
/
0
~
~
71
72
G
H
G
H
95
96
#
- Q
# 119
120
w
x .
II:
49
50
51
1
2
3
73
74
75
I
J
K
97
98
99
a
b
c
121
122
123
y
z
{
49
50
51
1
2
3
::J
~
~
73
74
75
I
J
K
I
J
K
97
98
99
a
b
c
~1
1I1
[-=
~
121
122
123
y
z
1/4
..
:.
:I
52 4 76 L 100 d 124 52 4 iJ 76 L L 100 d ~ 124
•
•
II
53 5 77 M 101 e 125 } 53 5 IJ 77 M M 101 e -.; 125 3/4
5~ 6 78 N 102 f 126 -* 54 ~ 78 N N
6 102
-=
•--,-*.•
f 126
55 7 79 0 103 9 127
• 55 7 rl 79 0 0 103 9
-= 127
ASCII codes (A) for character mode (C) and graphic mode (G).
The following commands are used as control functions and are typed at the
keyboard:
112
Appendix 5: Differences between
ABC 800 and ABC 802
This appendix contains the differencies in the BASIC program for ABC 802 as com-
pared with the program for ABC 800. The paragraphs affected are indicated with ABC
802 in the text margin.
Miscellaneous statements:
COMMON and DIM sets the size of variables.
STOP, TRACE, and NOTRACE facilitate the debugging of a
program.
WIDTH chooses the number of characters per line (40 or 80).
8 Commands
(Page 24)
• the devices are addressed as ORO:, DR1 :, CAS:, PR:, CON:, or MEM:.
• the primary default device is disk drive 0 (ORO:) and the secondary one is disk drive
1 (DR1 :). If both a disk drive and a cassette recorder are connected, the device
CAS: must be given if a command is to act on the cassette recorder. Correspon-
dingly, the device MEM: must be given if a command is to act on the external
memory.
Note A long program is listed on the screen until it is filled. The next line
will be displayed when you press the space bar. A listing can be
stopped by CTRUC, RETURN or any BASIC command.
70876-173 113
LOAD (page 29)
Note If no extension is given, the computer will first search for .BAC and
then .BAS. The entire file is read, until EOF (end of file) and not
only to the END.
Example 2
If the same program had been stored on an external storage
under the name AADDB, the screen would look like this:
114 70876-774
UNSAVE (page 32)
Note When the extension is omitted, the computer will look for .BAC
first and then .BAC.
The command UNSAVE cannot be used on an erase protected
file or on MEM:.
Example When the file XYZ.TXT on the disk is no longer needed, the file
can be erased from the disk by means of the following statement:
Note that the instruction KILL does not function together with
MEM:.
Note When data is to be read from an existing fHe, the file should be
opened by the OPEN instruction. Up to seven files may be open at
the same time.
70876-775 115
PREPARE (page 53)
Example
Function Denotes number of characters per line for the current file. When #
file number is omitted the screen is intended (40 all. 80 charac-
ters).
Example
Inverted video can be displayed. This is done by inserting (1) bit 8 (128) into the ASCII-
value of the character in question. The following programming example can be used for
presentation of inverted video.
N.B.
Programs for colours can be written on ABC 802 for later execution on ABC
800 C and ABC 806. ABC 802 cannot be used for presentation of colours.
10816-117 117
When you have finished the picture on a copy of the chart you can type the lines one by
one. Do not forget to allow space for the control characters, if you vary the control
arguments.
Note that the capital letters still remain the same in graphic mode. You can mix capital
letters and graphic characters just as you like.
In graphic mode there are 72 graphic lines (0-71), each one with 78/158 graphic
positions (0-77/157).
The number of graphical positions/line is dependent upon which character mode has
been selected, 40 or 80 characters.
A C G A C G A C G A C G
32 Blank D 56 8 ~ 80 P P 104 h [j
33 ! LJ 57 9 ~ 81 Q Q 105 i ~
34 " [j 58 ~ 82 R R 106 j [J
35 # ~ 59 ; ~ 83 S S 107 k r1
36 $ ~ 60 < ~ 84 T T 108 l ~
37 0/0 ~ 61 = 113 85 U U 109 m ~
38 & ~ 62 > ~ 86 V V 110 n ~
39 ~ 63 ? ~ 87 W W 111 a ~
40 ( G 64 @ @ 88 X X 112 p ~
41 ) ~ 65 A A 89 y y 113 q ~
42 • ~ 66 B B 90 Z Z 114 r ~
~
43
44
+
~
67
68
C
0
C
0
91
92
[
\
[
\
115
116
s
t =
iJ
IJ
45 - ~ 69 E E 93 ] ] 117 u
46 ~ 70 F F 94 t t 118 v ~
~ 71 95 119
47
48
/
0 ~ 72
G
H
G
H 96
- -
Q 120
w
x
-=~
49 1 ~ 73 I I 97 ~ 121 y
50 2 ~ 74 J J 98
Cl
b c= 122 z
=-~
5·1 J Cj 7S K K 99 ( ~ 123 { CI
52 4 iJ 76 L L 100 d ~ 124 , iii
53 5 IJ 77 M M 101 e ~ 125 } Ii
54 6 ij 78 102 f ~ 126 -* ~
•
N N
55 7 ~ 79 0 0 103 g ~ 127
•
ASCII code interpreted into character mode (C) and graphic mode (G).
Argument CHR$( ) Argument CHR$( )
RED 129 GVEL 147
GRN 130 GBLU 148
VEL 131 GMAG 149
BLU 132 GCVA 150
MAG 133 GWHT 151
CVA 134 HIDE 152
WHT 135 GCON 153
FLSH 136 GSEP 154
STDV 137 BLBG 156
NRML 140 NWBG 157
DBLE 141 GHOL 158
GRED 145 GREL 159
GGRN 146
118 10816-118
9(800 VIDEO GRAPHICS CHART PROGRAM .
o ~~ I ~ ~
••
·88
1 :; ~ i~ ~I
85
2: I~I
3 :~
80 I ~~~
t~t
4 :: .:-:-:-:.
57
5 ::
54 tI~
6 :~
51 I~I
7 :~ r I~
48 :::::::::
:~
8 45 !i~i ~i!~!
9~
42 :I!I
41
10 40
39 II~:
38
11 37 fiI
36 :::::::::
35
12 34
33 ! ~! f!
32
13 31
30 I:!j!j!
29
14 28
27 i!i!~il
26
15 25
24 t!i!i!
23
16 22 t ~I
21 ::::::::-
20
17 19
18 ~f~I
18 ~i14 ~!r!I
19 13
12 IiI
.1
20 10
s !I!t
8
21 7
R ·i!~!t!
5
22 4
~
3
...... 2
-o 23 1 I/III/!II
0
lOOT 11 1 11 1 1 1 12 2 7 ~ 1 / i / / /
ID a~ In ~ 3 n~
:ff:01 23 45 I~!~ I" la·~ la'~
1 2,3 14:5 6i~ I~'g 81~ ,~ ~ ;;1""" 2.3 ~ 6.1.
CHR; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
Function Used for printing text and graphics. The arguments control the
colour selection etc. A G at the beginning of the colour selection
argument (e.g. GRED) sets the line to the graphic mode so that all
characters within quotes are interpreted as being graphics (see
the ASCII table). If CUR (L,N) is specified, the picture is drawn
from the starting point at line L (0-23), position N (0-39).
GRED, GGRN,
GVEl, GBlU,
GMAG, GCVA,
GWTH Colour graphics
Example
The programs can thus be written for colour, for execution on, for
example, ABC 800 C.
120 70876-720
TXPOINT (page 81)
Format TXPOINT X,Y [,1/0]
where X=0-77/157 and Y=0-71.
Example
The lines 10-40 clear the screen and set it to the graphic mode
(green). The lines 50-70 draw a sine curve. Line 80 displays 81 NE
in red, flashing text. TXPOINT can also be used as a function, to
check if a point is turned on (-1) or off (0). TXPOINT(X, V).
Function Turns off a graphic point (the origin is in the upper left-hand
corner).
70876-727 121
12 High Resolution Graphics
(page 83)
13 Function Keys
(page 90)
ABC 802 is provided with special function codes. These are generated by CTRL,
SHIFT and certain alphanumeric keys, see table 1.
These function codes correspond completely with the codes which are generated by
ABC 800 function keys (PF1-PF8).
A programmer can assign various functions to the function keys, e.g. cursor move-
ments, jump to a program module etc. For assigning the same functions to ABC 802 as
those included in ABC 800, the following combinations are used.
The function keys can produce 32 different ASCII values as shown in the following
table:
Table 1
Table 2
122 70876-722
When a function key is pressed, a subroutine can be called as shown below:
Example
When a function key is pressed at INPUT or INPUT LINE, an error is generated. The
ERRCODE is 53. The program should contain a routine which handles error 53. To find
out which one of the function keys that was pressed, use the function SYS(6) and read
the character by means of GET.
70876-723 123
Appendix 1: BASIC II Errata (page 108)
Appendix 1 is omitted.
HEXA-
DECIMAL DECIMAL OCTAL
ADDRESS ,-. ---., ADDRESS ADDRESS
SIMPLE VARIABLES
65280 FFOOH 377:000
MEMBUF : CASBUF 2
65024 FEOOH 376:000
CASBUF 1
64768 FDOOH 375:000
32 kB RAM
WORKING STORAGE
1. The display storage (2 kB) is parallel with the system program in PROM. Likewise
is the MEM: storage (32 kB) parallel with the system program for BASIC. The
different areas of the memory do not interact. ABC 802 runs in a special mode
when the graphics storage is addressed. If storage space for machine language
routines is to be allocated, the following addresses are changed:
• The pointer for the lowest memory address of a BASIC program (BOTTOM):
65292
• The pointer for the highest memory address of a BASIC program (TOP):
65294.
124 70876-724
ABC 802 Memory Map with Disk Drives
HEXA-
DECIMAL DECIMAL OCTAL
ADDRESS ADDRESS ADDRESS
SIMPLE VARIABLES
65280 FFOOH 377:000
SYSTEM VARIABLES
64768 FDOOH 375:000
CASBUF 2 DOSBUF 7 MEMBUF
64512 FCOOH 374:000
CASBUF 7 DOSBUF 6
64256 FBOOH 373:000
DOSBUF 5
64000 FAOOH 372:000
DOSBUF 4
63744 F900H 371 :000
DOSBUF 3
63488 F800H 370:000
DOSBUF 2
63232 F700H 367:000
DOSBUF 1
62976 F600H 366:000
DOSBUF 0
62720 F500H 365:000
STACK
32 kB RAM
WORKING STORAGE
10816-125 125
Appendix 4: Keyboard Layout, ASCII Codes (page 111)
(JJCDwrnrnrnrnrnrn(I)[J@J[J
~ @] ~ [IJ @ W~ @] CD @] 0 CD OJ (RETURN)
80@]@J(I)@J®0@(IJCDCDITJ8
a0~@J0~~~OO88G
( )
126 70876-726
A C G A C G A C G A C G
Argument CHR$( )
32 Blank D 56 8 ~ 80 P P 104 h [j
-
33 I ~ 57 9 ~ 81 Q Q 105 i ~
RED 129
34 " [j 58 ~ 82 R R 106 j [J
GRN 130 35 # Lj 59 ; ~ 83 S S 107 k n
VEL 131 36 $ ~ 60 < ~ 84 T T 108 I ~
BlU 132 37 0/0 ~ 61 = ~ 85 U U 109 m ~
MAG 133 38 & ~ 62 > ~ 86 V V 110 n ~
CVA 134 39 ~ 63 7 ~ 87 W W 111 0 ~
40 ( G 64 @ @ 88 X X 112 p ~
WHT 135
FlSH
STDV
136
137
41
42
43
.
+
) ~
~
~
65
66
67
A
B
C
A
B
C
89
90
91
y
Z
[
y
Z
[
113
114
115
q
r
s
C;J
~
Decimal codes obtained from function keys and their correspondence in ABC 800.
The following commands are used as control functions and are typed at the keyboard:
70876-727 127
Appendix 6: Differences between
ABC 800 and ABC 806
This appendix contains the differencies in the BASIC program for ABC 806 as com-
pared with the program for ABC 800. The paragraphs affected are indicated with ABC
806 in the text margin.
Miscellaneous statements:
COMMON and DIM sets the size of variables.
STOP, TRACE, and NOTRACE facilitate the debugging of a
program.
WIDTH chooses the number of characters per line (40 or 80).
8 Commands
(Page 24)
• the primary default device is disk drive 0 (DRO:)and the secondary one is disk drive
1 (DR1 :).
70876-729 129
WIDTH (page 61)
Function Denotes number of characters per line for the current file. When #
file number is omitted the screen is intended (40 all. 80 charac-
ters).
The number of characters is a number between 0 and 255.
Example
130 70876-730
11 Graphics including attribute
handling (page 78)
ABC 806 can use graphics with a resolution of 78/158 x 72 pixels (picture elements). If
the 40 character mode (78 pixels) is used, the graphics are compatible with the
VIDEOTEX standards.
A separate attribute in the computer can be used for storing control characters for text
and graphics. However, in the VIDEOTEX mode the control characters are saved in the
character storage. The instruction ATTRIBUTE 1 enables you to determine which
version to use.
High resolution graphics (see chapter 12) can be used in conjunction with ordinary text
and graphics, since the high resolution graphics are saved in a separate storage. By
defining a priority of your own choice, you determine what will be displayed first.
ABC 806 graphics correspond to the VIDEOTEX standards. In the graphic mode every
output character is interpreted as a graphic character formed by a combination of six
graphic points.
When text or graphics are displayed on the screen, the selection of colours etc. is
controlled by means of certain arguments in the PRINT statement. The statement
affects one line at a time. Each argument puts a control character on the screen.
Although these characters are invisible, they take up one position each. The control
characters can be covered by a background colour, if the control arguments are given in
the correct order.
Black (BlK)
Red (RED)
Green (GRN)
Yellow (VEL)
Blue (BLU)
Magenta (MAG)
Cyanide (eVA)
White (WHT)
The characters available in the ABC 806 are listed below. The table gives the ASCII
value of each character and its meaning in the character mode and graphic mode. One
way of planning a graphical picture is to draw it on a copy of the graphics chart and feed
the program the appropriate data.
When you have finished the picture on a copy of the chart you can type the lines one by
one. Do not forget to allow space for the control characters, if you work with AT-
TRIBUTE 0 or if you have not indicated any attribute.
Note that the capital letters still remain the same in graphic mode. You can mix capital
letters and graphic characters just as you like.
The number of graphical positions/line is dependent upon which character mode has
been selected, 40 or 80 characters. In VIDEOTEX standards there are only 40
characters/line.
70876-737 131
11.1.1 ASCII codes for characters, graphics and arguments
A C G A C G A C G A C G
32 Blank D 56 8 ~ 80 P P 104 h [j
33 ! ~ 57 9 ~ 81 Q Q 105 i ~
34 " [j 58 ~ 82 R R 106 j []
35 # lj 59 ; ~ 83 S S 107 k n
36 $ ~ 60 < ~ 84 T T 108 l ~
37 0/0 ~ 61 = ~ 85 U U 109 m ~
38 & ~ 62 > ~ 86 V V 110 n ~
39 ~ 63 ? ~ 87 W W 111 0 ~
40 ( G 64 @ @ 88 X X 112 P ~
41 ) ~ 65 A A 89 Y Y 113 q ~
42 • ~ 66 B B 90 Z Z 114 r ~
43
44
+ ~
~
67
68
C
0
C
0
91
92
[
\
[
\
115
116
s
t
=
iJ
45 - ~ 69 E E 93 ] ] 117 u IJ
46 ~ 70 F F 94 t t 118 v ~
47 I ~ 71 G G 95 - - 119 w
48 0 ~ 72 H H 96 Q 120 x
-=~
49 1 ~ 73 I I 97 Q ~ 121 y ~
50 2 ~ 74 J J 98 b ~ 122 z ~
51 3 Cj 75 K K 99 ( ~ 123 { CI
52 4 iJ 76 L L 100 d ~ 124 , iii
53 5 IJ 77 M M 101 e ~ 125 } Ii
ij 102 ~ 126 -* ~
•
54 6 78 N N f
55 7 r 79 0 0 103 9 ~ 127
•
ASCII codes (A) for character mode (C) and graphic mode (G).
132 10816-132
®
-J.
00 VIDEO GRAPHICS CHART PROGRAM . -J.
-J.
o 89~~ fti i\)
88 :-:.:.:-:
1 87
66 t :~:~:
85 s::
2:; II~ n>
'U
3 :~
80 !~!~ !~!~! o
59 --h
4 58
57 !!!if! CO
56 ~
5 55
54 t~~I n>
'U
6 ~~ ::T
51 j!j~t~~
7 :~ :;::::::: o·
:::::::::
48 en
8 :~ o
45 !~!i !i!i!
~
9~ ~I~I
42 :-:..:-:- ~
41
10 40 o
39 f~~t
38 o
11 37 t t~ ::T
36 :::::::::
35 n>
~
12 34
33 I!!!!! n>
32
13 31 0-
30 f~~j!~! CD
29
~
14 28
27 i!i!!iI en
26
15 25
24 !i!i!i!!!
23
16 22
21 i~i . i~i~i
17 ~: !!i!ii!i!i
17 :::::::::.
18 ~~ ~{·~t
14
12
19 13 iii! i!i!~
n
9
20 10 !t!~!!!
8
21 7
6 :i!i!!i!ii:
5
22 4
3
w 2
w 23 1
0
11 11 11 2 2 ':I ..
lOOT 3 4 ;~16 6~ 1 7 7
iiiiJI:.0 1 2 34 5 16 7 18 Q o1
161 I~I~ 14 5 Ib
111 1 ....
tilH 1M Y
12 ~ ~ ~ ~~ ~ 7 8'9 ~
"1 ? ~ 4:5 ~i~ ,~~ ~I~ I~ ~ ~16 .tl
7 T7,7
~2.3 II 6.1_
CHR'
I
0 1 2 3 4 5 6 7 8 910 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 .32 33 34 35·36 37 13839
If ATTRIBUTE 1 has been specified, all control characters will be stored in a separate
attribute memory. Then colours etc. can be changed one by one without affecting the
content of the character memory. Since the control character and the actual character
are in parallel in the memory, they will be displayed in the same position on the screen.
134 70876-734
11.4 Instructions (page 81)
ATTRIBUTE
Format ATTRIBUTEn
PRINT
Format PRINT [CUR(L,N)]argument [;argument; ...]"text"
Function Used for printing text and graphics. The arguments control the
colour selection etc. A G at the beginning of the colour selection
argument (e.g. GRED) sets the line to the graphic mode so that all
characters within quotes are interpreted as being graphics (see
the ASCII table). If CUR (L,N) is specified, the picture is drawn
from the starting point at line L (0-24), position N (0-39/79).
GRED, GGRN,
GVEL, GBLU,
GMAG, GCVA,
GWTH, GBLK Colour graphics and capital letters
70876-735 135
GCON, GSEP Continuous, separated graphics
N.B. Cannot be generated on ABC 806
Example
The instructions TXPOINT, SET DOT, CLR DOT, and DOT in an ABC 800 program
cause no action on the screen of ABC 806. Instead you will get an error message, see
chapter 15.
• Graphics according to ABC 800, where colours are selected by means of the table
in section 12.4. Resolution is 240x240 picture elements (pixels).
• Graphics freely selected among four colours. Text and graphics can be mixed on
the screen and they can be assigned different priorities. Resolution is 512x240
pixels.
• Graphics freely selected among 2x8 colours. Text and graphics can be mixed on
the screen and they can be assigned different priorities. Resolution is 256x240
pixels.
Each pixel can be addressed independent of the others by specifying its X and Y
coordinates. The origin of the picture is in the lower, left-hand corner and the positions
are numbered from a to 239, alt. 256/512 and 0 to 239.
136 10816-136
239 ---
I
I
y
I
o
o x 239
256/512
The screen is adjusted to obtain the following relations between height and width:
Which resolution is obtained (256 or 512 pixels) is dependent on the number of colours
selected. If you select no more than four colours, the resolution will be 512x240 pixels.
After selection, the colours are assigned the serial numbers 0-3, which are used for the
instructions FGFILL, FGLINE and FGPAINT.
The letter G before the name of the colour means that this is the foregound colour. As
described above, the instruction FGFILL X, Y, 0 will assign priority 1 to the graphics, i.e.
the graphics will be in front of any text displayed. On the other hand, if FGFILL X, Y, 1 is
specified, the graphics will be behind the text.
If more than four colours are selected, the resolution will be 256x240 pixels and
colours in the range 0 to 15 can be used.
10816-137 137
You can use the instruction FGPICTURE to select a certain picture to be displayed
while the computer is generating another picture.
Example FGPICTURE 0, 1, 2
In this example picture 1 will be displayed while picture 0 is generated. The last digit
denotes the number of pictures.
However, a picture is not displayed automatically. You must give the instruction FGCTL
to display the picture on the screen. If FGPICTURE is not specified, picture 0 will be
displayed.
The high resolution graphics can be used together with text and graphics (according to
chapter 11), since the information is stored in separate memories.
If the high resolution graphics is not used, the whole graphics memory space (128
Kbyte) can be used as data storage or RAM-floppy.
• The colour number is a number from 0 to 3 all. 0 to 15. When using a mode
compatible with ABC 800 the meaning of the number can be seen in section 12.4.
• The colour number is optional. If no colour number is given, the previous colour
number will be used.
FGCTL
138 10816-138
The following colours are available
----------------------
Background colour Foreground colour
FGCTL BLK+RED+GCVA+GVEL
FGCTL BLK+RED+BLU+WHT+GRED...
FGFILL
FGLINE
FGPAINT
FGPICTURE
Example FGPICTURE 2, 3, 4
70876-739 139
CAUTION I
The graphics memory will be erased if you shift to high resolution graphics
by using a colour selection command that is compatible with ABC 800.
FGPOINT
Format FGPOINT x,y[,colour number]
FGPOINT, function
Format FGPOINT (x,y)
12.3 Examples
140 10816-140
Lv L in-nsoi
12.3 Animation mode (Page 85)
For colour selection commands 1-71 the colour 0 is displayed behind the text, whereas
colours 1-3 are displayed in front of the text.
In the interval 72-127 the colour 0 and the colour being the same as colour 0 are
displayed behind the text, whereas the other two colours are displayed in front of the
text.
From 128 upwards all high resolution graphics are displayed in front of the text.
The computer enables the use of special function codes. These are generated in
different ways dependent on which keyboard is used. The table below shows which
keys are to be operated on the different keyboards in order to generate the function
codes. A total of 32 different codes can be used to accomplish different, fixed functions
when you are programming. Examples of such functions are cursor movements,
change of pages or jump to a program module.
A programmer can assign various functions to the function keys, e.g. cursor move-
ments, jump to a program module etc. For assigning the same functions to ABC 802 as
those included in ABC 800, the following combinations are used.
142 70876-742
ABC 77 and Value ABC 55
ABC 22
Example
When d function key is pressed at INPUT or INPUT LINE, an error is generated. The
ERRCODE is 53. The program should contain a routine which handles error 53. To find
out which one of the function keys that was pressed, use the function SYS(6) and read
the character by means of GET.
70876-743 143
14 Differences in BASIC between
ABC 800 and ABC 80 (Page 91)
This section is not valid for ABC 806.
The instructions TXPOINT, SET DOT, CLR DOT and DOT in a program for ABC 800
cause no action on the screen of ABC 806. However, the error message 200 is
generated. See chapter 15.
CLR DOT, DOT, SCR, SET DOT and TXPOINT are omitted.
Format ATTRIBUTEn
Function Controls which picture shall be displayed and which picture shall
be generated.
144 10816-144
SYS (page 105) (function) Page 76
Format SYS(I°1f> )
Appendix 1 is omitted.
10816-145 145
Appendix 2: The I/O ports of ABC 806 (Page 108)
146 10816-146
Appendix 3: Storage Disposition (Page 109)
65535
I 64 kbyte Graphic/Data memory
FFFFH 377:377
65280 Variables
FFOOH 377:000
System variables
64768 -- FDOOH 375:000
DOSBUF7
64512 FCOOH 374:000
DOSBUF6
64256 FBOOH 373:000
DOSBUF5
64000 FAOOH 372:000
DOSBUF4
63744 F900H 371:000
DOSBUF3
63488 F800H 370:000
DOSBUF2
63232 F700H 367:000
DOSBUF1
62976 F600H 366:000
DOSBUFO
62720 F500H 365:000
32 kbyte RAM
Working memory
24 kbyte PROM
BASIC II
~
The display storage (2 kbytes) is parallel with the system program for high resolution
graphics. The two areas of the memory do not interact. ABC 806 runs in a special mode
when the graphics storage is addressed. When the operating system CP/M is loaded
parts of the graphics storage is used.
• The pointer for the lowest memory address of a BASIC program (BOTTOM): 65292
• The pointer for the highest memory address of a BASIC program (TOP): 65294.
70876-747 147
Appendix 4: Keyboard Layout, ASCII Codes
(Page 111)
88
88
BB
BEJ
Alphanumeric
keys Function
keys Numeric
keys
ABC 22
148 70876-748
Codes obtained from the keyboard
The following commands are used as control functions and are typed at the keyboard:
70876-749 149
19 Index
A CTRL/I 112
CTRL/L 112
ABS, mathematical function 63,95 CTRL/S 20, 112
ADD$, string function 67,95 CTRL/X 112
Addition 12 CUR, function 73,96
Animation mode 85 CVT, function 73,96
AND, operator 14 CYA 78,81
Arithmetic expression 4
ASCII, string function 68,95
ASCII table 79, 112
ATN, mathematical function 63,95 D
AUTO, command 25,95
DATA, instruction 36,96
Data 7
B DBLE 81
Debugging 10
Declaration 13
$BAS 26,95
DEF-FN, instruction 13,36,96
BAC, file extension 32
Device 5,24
BAS, file extension 28
DIGITS, instruction 38,97
BASIC interpreter 1
DIM, instruction 9, 15,39,97
BLBG 81
Dimension 9
BLU 78,81
Direct mode 3
Buffer 10
Disk operating system 26
BYE, command 26,95
DI.V$, string function , 68,97
DOT, instruction - graphics 82,97
DOUBLE, instruction 82,97
DOS 26
c
CALL, function 73, 95
CHAIN, instruction 35, 95
Character strings 15
CHR$, string function 68, 95
CLEAR, command 26, 96
CLOSE, instruction 11, 35, 96 E
Closing a file 11
CLRDOT, instruction - graphics 82, 96 ED, command 27,97
Colon 2,4 Editing 19,27
Colour 78 END, instruction 40,97
Colour selection command 86 EOF, end-of-file 11
Colour selection table 86 EQV, operator 14
Commands 24 Erase 19
Comment 3 ERASE, command 28,97
COMMON, instruction 35, 96 ERRCODE, function 74,97
COMP%, string function 68, 96 Error handling 5
CON, command 26, 96 Error messages 92
Conditional jump 44,60 Exclamation point 3
Constants 7 Execution 20
Conventions 24 Exclusive OR (XOR), operator 12,14
Corrections of program 19 EXP, mathematical function 63,97
COS, mathematical function 63, 96 Exponentiation 62
COUNT 10, 43, 98 Expression 4
CTRL/C 20,112 EXTEND, instruction 40,97
CTRL/H 112 EXTEND mode 8,40
150
F
GBLU 81 K
GCON 81
GCYA 81 Key word 3
GET, instruction 42,98 KILL, instruction 47,99
GET£-COUNT, instruction 10,43,98
GGRN 81
GHOL 81
GMAG 81
GOSUB, instruction 43,99
GOTO, instruction 44,99 L
Graphics 78
GRED 81
GREL 81 LEFT$, string function 69,99
GRN 78,81 LEN, string function 00, 100
GSEP 81 LET, instruction 47, 100
GWHT 81 Line number 2
GYEL 81 LIST, command 28, 100
LOAD, command 29,100
LOG, mathematical function 64, 100
LOG10, mathematical
function 65, 100
Logical device 5
H Logical expressions 4
Logical integer variables 14
HEX$, mathematical function 64,99 Logical operators 14
HIDE 81 Logical variables 14
High resolution graphics 83 Loop 41
151
M p
152