N S B 8

BASIC Int.

for cards with Z80, and Z180, code compatible

ENGLISH (PDF) Technical Manual of FREE NSB8 BASIC interpreter for Z80. Length = 770.000 bytes

Ver.5.10 - Rel. 19 April 2000.


GENERAL FEATURES

NSB8 is a powerful software development tool which allows high-level programming in BASIC on all the grifo® boards based on Z80 microprocessor family. The code produced by NSB8 requires the functions and features of CP/M operating system or the similar rom-based operating system GDOS 80. The development environment is extremly friendly and achieves to reduce the development time, being anyway compliant to the operational feeling of all the BASICs. Unexperienced programmers will be able to take advantage of its numberouses commands and functions, becoming productive in few hours of work, while experienced programmers won't need any training. However the great code performance and the rapidity of hardware intervents make the NSB8 an unreplaceable work instrument for all the applications.

The interpreter supports mathematic functions, control applications, data base management, interfacing to generic consoles, operating system calls and many other features designed to solve industrial automation problems.

NSB8 is a programming and development environment made by a set of independent items that can be used or not by the programmer, without any limitation. Wishing to make comparisions amongst NSB8 and other well-known BASIC programming tools, we detect that NSB8 has an environment and instruction, command set comparable to the GWBASIC's one.

NSB8 enables to take the greatest advantage of the hardware resources from the boards you are using, because you may use them directly through the high-level instructions, with no need to develop specific firmware. For example, NSB8 has the capacity to manage hardware resources like serial lines, printers, mass storage devices, operator interfaces, etc.

NSB8 software package is made up by a set of disks, a rich reference manual and a great number of examples (both source and tokenized code) showing how to use the control board's hardware resources.


NSB8 FEATURES

Fundamentally NSB8 has two main working modalities: source development mode and an utility mode that simplify and optimize the development phase. The main characteristics of these two modalities are described as follows:


- Utility: the NSB8 is supplied with some utility programs and proper documentation, that:

- Source development mode: this is the situation normally used by the end user and it includes the editor, the BASIC interpreter and the debugging environment. Use of this mode is common to all languages, it allows to:

1) Write and correct the source of the application program (this phase can be performed by the integrated editor or an external ASCII editor, like the GET 80's one ).
2) Upload the source to the board using the features of GDOS 80 file system.
3) Run the uploaded program directly on the control board . If during the functional test of the program problems are detected, you must go back to point 1
4) Generate the GDOS 80 executable form (for example ready for EPROM, or FLASH EPROM burning).
 

Amongst the many characteristics of this development environment, we remind:


NSB8 REQUIREMENTS

Z80 based control card

It is the electronic card that belong to grifo® industrial set, based on Z80, Z180, HD64180 and compatible microprocessors, as:

Independently from the application to develop, the target card must be provided of:


Personal Computer

A personal computer provided of:

An hard disk is not necessary but recomended to speed all the files management operations.


NSB8 SOURCE FILE SYNTAX

The NSB8 sorce files must have the following syntax:

<file name>.B

Where <file name> is a 6 character sequence valid for the used operating system.

 

NSB8 DATA FILE SYNTAX

The data files managed by NSB8 must have the following syntax:

<file name>.<ext>

Where <file name> and <ext>, are respective 6 and 3 character sequence valid for the used operating system.

ARITHMETIC OPERATORS

OPERATORS

 FUNCTION

EXAMPLE

 ^

 Exponentation

 9^2=81

 *

 Multiplication

 5*1.5=7.5

 /

 Division

3/2=1.5 

 -

 Subtraction

 3.2-2=1.2

 +

 Addition

 7.9+2.1=10

 -

 Negation

 -3, -27

RELATIONALS OPERATORS

OPERATORS

 RELATION

EXAMPLE

 >

 Greather than

(6>1)=1 (true)

(2>3)=0 (false)

 <

 Less than

 (0<0)=0 (true)

(1<3)=1 (false)

<=

 Less than or Equal to

(5<=5)=1

(3<=5)=1

(3<=5)=1

>=

 Greather than oe Equal to

 (8>=7)=1

(7>=7)=1

(6>=7)=0

=

 Equal to

 (9=9)=1

(9=7)=0

<>

 Not equal to

 (4<>5)=1

(2<>2)=0

 

LOGIC OPERATORS

OPERATORS

 FUNCTION

EXAMPLE

 AND

 Logic AND

 A>3 AND A<6

 OR

 Logic OR

 A>3 OR A>6

 NOT

 Logic negation

NOT (A>3 )

The boolean operators described in the previous table always return a boolean value (true or false), not a numeric value.

 

 ORDER OF EVALUATION OF OPERATORS

 NOT , -

 Logic and arithmetic negation

 ^

 Exponentiation

 * , /

 Multiplication and Division

 + , -

 Addition and Subtraction

 = , < , > ,<= , >= , <>

 Relational operators

 AND

 Logic AND operator

 OR

 Logic OR operator


FORMATTED PRINTING

Syntax rules:

PRINT %<format specifier string><format character>,<variables, expressions, ...>

 

Format specifier string:

Floating format - nFm
Integer format - nI
Scientific format - nEm

n = number of integer digits
m
= number of decimal digits

 

Format character:

A - Counting
C- Comma for each 3 digits group
Z - Suppress trailing zeroes
+ - Sign value
$ - Dollar sign
# - Default format


NSB8 LINE EDITOR

Control G - Copy to end of line
Control N - Delete for a new insertion
Control A - Copy a character
Control Q - Go one character back
Control Z - Delete one character
Control D X - Copy till X character
Control Y - Enable and disable the insert mode


INTERNAL FUNCTIONS

 

Mathematic functions

ABS - ABSolute value (<expression>)
ATN - ArcTaNgent (<numeric expression>)
COS - COSine (<numeric expression>)
EXP - EXPonential value (<numeric expression>)
INT - INTeger value (<numeric expression>)
LOG - LOGarithmic value (<numeric expression>)
SIGN - SIGN of a number (<numeric expression>)
SIN - SINe (<numeric expression>)
SQRT - SQuare RooT (<numeric expression>)

 

String functions

ASC - ASCii value (<string expression>)
CHR$ - CHRaracter$ (<numeric expression>)
LEN - LENgth of a string (<string name>)
STR$ - STRing$ (<numeric expression>)
VAL - VALue (<string expression>)

 

Input functions

INCHAR$ - INput a CHARacter$ (<device#>)
INP - INPut a byte (<port address>)

 

File functions

FILE - FILE type (<file name>)
FILEPTR - FILEPoinTeR position (<file#>)
FILESIZE - FILESIZE (<file#>)
TYP - TYPe of file pointer (<file#>)

 

Utility functions

CALL - CALL machine language (<memory address> [,<argument>])
EXAM - EXAMine memory (<memory address>)
FREE - FREE memory (<argument>)
TAB - TABulate (<#expression>)
RND - RaNDom (<#expression>)


USER DEFINED FUNCTIONS

DEF <function name> (<parameter list>) [=<expression>]
RETURN <numeric or string variable>
FNEND


DIRECT COMMAND

ALOAD <FILENAME>
ASCSAV <FILENAME>
AUTO [<LINE>] [,<INCREMENTAL VALUE>]
BYE
CAT
[#<DEVICE#>] [,<DRIVE#>]
CONT
DEL
<LINE#>,<LINE#>
LIST [#<DEVICE#>] [,<LINE#>] [,<LINE#>]
LOAD <FILENAME>
MEMSET <MEMORY ADDRESS>
PSIZE
REM
[<LINE#>] [,<INCREMENTAL VALUE>]
RUN [<LINE#>]
SAVE <FILENAME>
SCR


INSTRUCTIONS

* IT CAN BE DIRECTLY USED AS A COMMAND

Instruction for program internal data management

DATA <CONSTANTS LIST>
READ <VARIABLES LIST>
*RESTORE [<LINE#>]

Input and output instructions

INPUT [<DEVICE#>] [,<STRING PROMPT>,] <VARIABLE LIST>
INPUT1 [<DEVICE#>] [,<STRING PROMPT>,] <VARIABLE LIST>
*OUT <PORT ADDRESS>,<BYTE VALUE>
*PRINT [@,(ROW,COLUMN)][#<DEVICE#>] [,<LIST OF EXPRESSIONS>]
*! [@(ROW,COLUMN)] [#<DEVICE#>] [,<LIST OF EXPRESSION>]

Control instructions

FOR <VARIABLE>=<INITIAL> TO <LIMIT> [STEP <VALUE>]
GOSUB <LINE#>
GOTO <LINE#>
*IF < LOGEXPR> THEN <STATEMENT> [ELSE <STATEMENT>]
ON <#EXPR> GOSUB <LIST OF LINE NUMBERS>
ON <#EXPR> GOTO <LIST OF LINE NUMBERS>
RETURN

File instructions

*APPEND [LINE#>,]<FILENAME>
*CHAIN <FILENAME>
*CLOSE #<FILE#>
*OPEN #<FILE#>[%<TYPEXPR>],<FILENAME>[,<SIZEVAR>]
*READ# #<FILE#>[%<RANDOM ADDRESS>],<LIST OF VARIABLES>
*WRITE# #<FILE#>[%<RANDOM ADDRESS>],<LIST OF EXPRESSIONS>

General instructions

*CLS [#<DEVICE#>]
*DIM <VARIABLE NAME (<ARRAY OR STRING DIMENSION>)
END
ERRSET
[<LINEA#>,<ERROR LINE NUMBER>,<ERROR NUMBER>]
*FILL <MEMORY ADDRESS>,<BYTE VALUE>
*[LET] <NUMERIC VARIABLE>=<numeric expression>
*[LET] <STRING VARIABLE>=<string expression>
*LINE [#<DEVICE#>,]<#expression>[,<#expression>]
REM <EXPLANATION COMMENT>
STOP


TERMS MEANING

LINE# - BASIC line number
DEVICE# - input, output device number
DRIVE# - disk drive number
FILENAME - name of the file
#EXPR - numeric expression
LOGEXPR - logic expression
TYPEXPR - a type of expression
FILE# - file identification number
[ ] - optional


TRAPPABLE ERRORS

ARGument - Error 1
DIMENSION - Error 2
OUT OF BOUNDS - Error 3
TYPE - Error 4
FORMAT - Error 5
LINE NUMBER - Error 6
FILE - Error 7
HARD DISK - Error 8
DIVIDE by ZERO - Error 9
SYNTAX - Error 10
READ - Error 11
INPUT Error 12
ARGument MISMATCH - Error 13
NUMERIC OVerflow - Error 14
STOP/control C - Error 15
LENGTH - Error 16


BASIC NSB8 Commands Table

 

 8

 9

 A

 B

 C

 D

 E

 F

 0

 LEF

 FN

 CLS

STEP 

 (

<= 

 1

 FOR

 DEF

TO 

 ^

 <>

 2

 PRINT

 !

THEN 

 ATN

 *

 3

 NEXT

 ON

  TAB

 FILESIZE

 +

 4

 IF

 OUT

ELSE 

 SORT

 FILEPTR

 <

 5

 READ

 FILL

CHR$ 

ADDR 

 =

 6

 INPUT

 EXIT

  ASC

INT 

 >

 7

 DATA

 OPEN

APPEND

  VAL

 /

 NOT

 8

 GOTO

 CLOSE

STR$ 

 FREE

 9

 GOSUB

 WRITE

 NOENDMARK

 INP

 A

 RETURN

  INCHAR$

SGN 

EXAM 

 B

 DIM

 CHAIN

FILE  

SIG 

 ABS

 C

 STOP

 LINE

  LEN

 COS

 END

 D

 END

CALL

LOG 

 OR

 E

 RESTOR

  RDN

 EXP

 F

 REM

 ERRSET

 TYP

 >=


B A S T R A

( BAS-ic TRA--sforma )

This Utility program transform a Tokenized Source Program reducing it to its smaller size (deletes all the REM statement, even if placed not at the beginning of the line; deletes all the useless white spaces; checks all the jump lines from GOTO, GOSUB, ON GOTO, ERRSET, etc. and change them properly: if they was directed to erased lines, they are updated to the first valid row subsequent the erased ones).
It is executed as a generic command file and when it is started it requires the working parameters:

1) the input file name (original file);
2) the output file name (modified file).

Both these files are complete file name with the format:

file name = drive:name.extension

In addition to the modified output file the BASTRA program creates a new file with the same name and .REM extension, that includes some statistics informations: number of deleted REMs, file length before and after the modification, list of the row line number modified,
etc. This general data are reported two times, in fact a two step method is used. The numbers of deleted REMs don't match because in the first step are counted all the REMs, while in the second step are counted only the REMs at the beginning of row; so this row is deleted!.
About the row counters, please remember that in tokenized source program there is one row more that is the empty last row with the end of program code 01.


B A S Y M

( BAS-ic SYM-bols )

This Utility program shows a complete List of the used Symbols and all their relations to the user Source Program, on the console output device.
It is executed as a standard command file and when it starts it asks for the input parameters:

INPUT:

1) file name complete of suffix (this is ".002" for BAZIC and ".B" for NSB8).

Attention: don't use ASCII file (i.e. ".SOH") but only those with internal BASIC form.

2) the type of operation that must be performed:

1 -> list only the symbols;
2 -> list symbols and line numbers;
0 -> exit from program.

3) type of output device:

V -> console monitor;
S -> printer.

OUTPUT: it is sufficient to read the messages on the screen and make some tests. However as output informations you will have:

1) a compressed table with the names of all the used variables;

2) an alphabetical list of all the used variables with the relative line numbers.


Page updated at October 30, 2004


homeHome Languages CartellaUtility Software Tables