Hello, here the full documentation. It seems working reasonably fast for a 2.5 Mhz machine. Soon photos and video. I have just few bytes left of my 8KB EPROM, so it is hard to improve. But if you like please let me know your comment and suggestions. I want also to post the performance. Do you know any standard testing BASIC routine? Thanks!
8BASIC (C) is a BASIC interpreter developed by manufacturer G.G in 2010 for the homemade Z80/AM95 8 bit NANO COMPUTER. see PICS
Due to the strong mathematical support of the AM9511 processor, the interpreter offers floating-point arithmetic and is just hold in 3KB of EPROM memory.
The most interesting feature of the 8BASIC is that each statement is eight characters fixed-length, which exactly fits the computer's LED display.
8BASIC doesn't have line numbers but uses line labels which may be referenced by control flow statements.
VARIABLES
Statements use variables to keep track of numbers or strings or labels.
Variables and labels must consist of only one alphabetical character.
So the maximum number of GOTO/GOSUB's arguments is 26 and the labelled addresses are precompiled into RAM in a separate table during the program editing.
The range of the 26 numeric values which can be entered or stored, lies between -9.99999 and +9.99999 x 10^5 (always displayed in 8-char fixed format: six digits plus sign and decimal dot). Variables are anyway stored in RAM in floating-point representation during program editing when declared (precomplilation) or during interpretation for the intermediate results. The precision of intermediate calculations depends on the APU 9511 capability (1 bit sign, 7 bit two's complement exponent and 24 bit of mantissa).
During editing, just after having selected the correct statement, you can easily change any of the 26 letters of each variable, navigating through the alphabet using the telephone-like keypad.
For example the generic statement "Z=X+Y" which performs the addition, can be easily modified in
"A=X+Y" or
"A=A+A" or
"Z=X+Z" or
"A=A+X" etc..
It is also easy to handle any algebraic expression using multiple 8-chars functions by chaining intermediate results.
For example Z=2*A+15*C can be written as:
" LET X="
"+15.0000" ;X=15
"X=X*C " ;X=15*C
"B=A+A " ;B=2*A
"Z=B+X " ;Z=2*A+15*C
Each of the 26 text variables may contain max eight alphanumeric characters and symbols, as per the complete DL2416 character set.
But you may build texts with more chars by concatenating strings stored in consecutive letters (variables), with the last string ending with the "#" char: text will be displayed by scrolling right-to-left. So technically the max size of a displayed string is 207 characters.
Here the typical "Hello Word" program which displays the string "Hello World" in an infinite loop:
" LET A$="
"HELLO WO" ; A$="HELLO WO"
" LET B$="
"RLD# " ; B$="RLD"
" "F": " ; F label
"PRINT+A$" ; display from right to left A$&B$ = "HELLO WORLD"
"GO TO F " ; goto F and loop
" END "
COMMANDS
The 8BASIC COMMANDS are used in direct mode from the "Menù"
1 "RUN CMD " ; cause the 8BASIC program to begin operating
2 "NEW CMD " ; erase the 8BASIC program and launch the program editor
3 "LIST CMD" ; launch the 8BASIC program editor
4 "SAVE SER" ; send out to an IBM PC the binary 8BASIC program resident in RAM through the serial port
5 "LOAD SER" ; write in RAM the binary 8BASIC program read from an IBM PC through the serial port
6 "SAVE PAR" ; send out to an IBM PC the binary 8BASIC program resident in RAM through the parallel port
7 "LOAD PAR" ; write in RAM the binary 8BASIC program read from an IBM PC through the parallel port
During editing you can delete and insert new lines. Navigation through statements and variables has been strongly facilitated in submenus.
STATEMENTS
8BASIC consists of 51 fixed-format statements.
During editing you can change any of the 26 letters of each variable in any of the 51 statements.
1 "IF A>B:N" ; jump to line label N if A is greater than B
2 "IF A=B:N" ; jump to line label N if A is equal to B
3 "IF A#B:N" ; jump to line label N if A is not equal to B
4 "IFA>=B:N" ; jump to line label N if A is greater than or equal to B
5 " "N": " ; line label N marking the destination of a GoTo/GoSub statement
6 "GO TO N " ; jump unconditionally to line label N
7 "GO SUB N" ; temporarily jump to line label N and returning to the following line
8 "RETURN " ; jump back to the statement following the original GOSUB statement
9 " END " ; terminate the execution of the program and suspends CPU operation
10 "Z=X+Y " ; add X and Y and assign the result to Z
11 "Z=X-Y " ; subtract Y from X and assign the result to Z
12 "Z=X*Y " ; multiply X and Y and assign the result to Z
13 "Z=X/Y " ; divide X by Y and assign the result to Z
14 "Z=SQR(X)" ; assign to Z the square root of X
15 "Z=INT(X)" ; assign to Z the integer of X
16 "Z=ABS(X)" ; assign to Z the absolute value of X
17 "Z=NEG(X)" ; assign to Z the value of X and change sign of Z
18 "Z=SGN(X)" ; assign to Z the sign function of X
19 "Z= (X)^Y" ; assign to Z the result of X raised to the power of Y
20 "Z=EXP(X)" ; assign to Z the result of e raised to the power of X
21 "Z=LOG(X)" ; assign to Z the common logarithm (base 10) of X
22 "Z= LN(X)" ; assign to Z the natural logarithm of X
23 "Z= PI " ; assign to Z the PI value
24 "Z=RAD(X)" ; assign to Z the radians value of X degrees
25 "Z=DEG(X)" ; assign to Z the degrees value of X radians
26 "Z=SIN(X)" ; assign to Z the sine of X (radians)
27 "Z=COS(X)" ; assign to Z the cosine of X (radians)
28 "Z=TAN(X)" ; assign to Z the tangent of X (radians)
29 "Z=ASN(X)" ; assign to Z the inverse sine of X
30 "Z=ACS(X)" ; assign to Z the inverse cosine of X
31 "Z=ATN(X)" ; assign to Z the inverse tangent of X
32 "Z=RANDOM" ; assign to Z a random integer number between 0 and 255
33 "T$=STR A" ; assign to T$ the value of variable A converted into the equivalent string
34 " LET A=" ; (two lines statement) set the numeric variable A to the following number
"+0.00000" ; 8BASIC standard numeric format is 6 digits plus sign and decimal dot
35 " LET T$=" ; (two lines statement) set the text variable T$ to the following string
"ABCDEFGH" ; 8BASIC standard string format is 8 chars (alphanumeric and special symbols)
36 "LET B==A" ; assign to variable B the numeric value of variable A
37 "K=INKEY$" ; make a program wait until a key is pressed and assign to K the pressed key
38 "INPUT A " ; ask the user to enter the numeric value of variable A
39 "INPUT T$" ; ask the user to enter the string value of variable T$
40 " CLS " ; clears (blank) the 16-segment LED displays and reset (0) the 7-segment ones
41 " CLEAR " ; reset variables to their default type value
42 "PRINT A " ; display the numeric value of variable A
43 "PRINT T$" ; display the string value of variable T$
44 "PRINT+T$" ; display and scroll the strings T$ and consecutives till encountering # char
45 "PAUSE T " ; suspend the program execution. Value of T is the time in ms to pause
46 "BEEP T,F" ; generate a tone. T is the tone duration (ms). F is the tone number (max 7)
47 " IN (A) " ; assign to variable A the binary value input from the 8 bit parallel port
48 " OUT (A)" ; output binary value of variable A to the 8 bit parallel port
49 "A=PEEK X" ; assign to variable A the byte value at the X memory location
50 "POKE X,A" ; write byte value of variable A into X memory location
51 "SYS X " ; branch (and jump back) to the machine language program at the X location
Each statement is precompiled as much as possible to make the interpreter run faster and it always occupies 16 bytes.
Statements allow you extreme flexibility. For example a FOR...TO..NEXT cycle can be easily written as:
LET I=+1.00000
LET U=+1.00000
LET T=number of cycles
N:
cycle
I=I+U
IFT>=I:N
END
Due to the internal RAM memory structure, the maximum size of the 8BASIC program has been set to 488 lines, which will fit the first 8K RAM chip.
8BASIC (C) is a BASIC interpreter developed by manufacturer G.G in 2010 for the homemade Z80/AM95 8 bit NANO COMPUTER. see PICS
Due to the strong mathematical support of the AM9511 processor, the interpreter offers floating-point arithmetic and is just hold in 3KB of EPROM memory.
The most interesting feature of the 8BASIC is that each statement is eight characters fixed-length, which exactly fits the computer's LED display.
8BASIC doesn't have line numbers but uses line labels which may be referenced by control flow statements.
VARIABLES
Statements use variables to keep track of numbers or strings or labels.
Variables and labels must consist of only one alphabetical character.
So the maximum number of GOTO/GOSUB's arguments is 26 and the labelled addresses are precompiled into RAM in a separate table during the program editing.
The range of the 26 numeric values which can be entered or stored, lies between -9.99999 and +9.99999 x 10^5 (always displayed in 8-char fixed format: six digits plus sign and decimal dot). Variables are anyway stored in RAM in floating-point representation during program editing when declared (precomplilation) or during interpretation for the intermediate results. The precision of intermediate calculations depends on the APU 9511 capability (1 bit sign, 7 bit two's complement exponent and 24 bit of mantissa).
During editing, just after having selected the correct statement, you can easily change any of the 26 letters of each variable, navigating through the alphabet using the telephone-like keypad.
For example the generic statement "Z=X+Y" which performs the addition, can be easily modified in
"A=X+Y" or
"A=A+A" or
"Z=X+Z" or
"A=A+X" etc..
It is also easy to handle any algebraic expression using multiple 8-chars functions by chaining intermediate results.
For example Z=2*A+15*C can be written as:
" LET X="
"+15.0000" ;X=15
"X=X*C " ;X=15*C
"B=A+A " ;B=2*A
"Z=B+X " ;Z=2*A+15*C
Each of the 26 text variables may contain max eight alphanumeric characters and symbols, as per the complete DL2416 character set.
But you may build texts with more chars by concatenating strings stored in consecutive letters (variables), with the last string ending with the "#" char: text will be displayed by scrolling right-to-left. So technically the max size of a displayed string is 207 characters.
Here the typical "Hello Word" program which displays the string "Hello World" in an infinite loop:
" LET A$="
"HELLO WO" ; A$="HELLO WO"
" LET B$="
"RLD# " ; B$="RLD"
" "F": " ; F label
"PRINT+A$" ; display from right to left A$&B$ = "HELLO WORLD"
"GO TO F " ; goto F and loop
" END "
COMMANDS
The 8BASIC COMMANDS are used in direct mode from the "Menù"
1 "RUN CMD " ; cause the 8BASIC program to begin operating
2 "NEW CMD " ; erase the 8BASIC program and launch the program editor
3 "LIST CMD" ; launch the 8BASIC program editor
4 "SAVE SER" ; send out to an IBM PC the binary 8BASIC program resident in RAM through the serial port
5 "LOAD SER" ; write in RAM the binary 8BASIC program read from an IBM PC through the serial port
6 "SAVE PAR" ; send out to an IBM PC the binary 8BASIC program resident in RAM through the parallel port
7 "LOAD PAR" ; write in RAM the binary 8BASIC program read from an IBM PC through the parallel port
During editing you can delete and insert new lines. Navigation through statements and variables has been strongly facilitated in submenus.
STATEMENTS
8BASIC consists of 51 fixed-format statements.
During editing you can change any of the 26 letters of each variable in any of the 51 statements.
1 "IF A>B:N" ; jump to line label N if A is greater than B
2 "IF A=B:N" ; jump to line label N if A is equal to B
3 "IF A#B:N" ; jump to line label N if A is not equal to B
4 "IFA>=B:N" ; jump to line label N if A is greater than or equal to B
5 " "N": " ; line label N marking the destination of a GoTo/GoSub statement
6 "GO TO N " ; jump unconditionally to line label N
7 "GO SUB N" ; temporarily jump to line label N and returning to the following line
8 "RETURN " ; jump back to the statement following the original GOSUB statement
9 " END " ; terminate the execution of the program and suspends CPU operation
10 "Z=X+Y " ; add X and Y and assign the result to Z
11 "Z=X-Y " ; subtract Y from X and assign the result to Z
12 "Z=X*Y " ; multiply X and Y and assign the result to Z
13 "Z=X/Y " ; divide X by Y and assign the result to Z
14 "Z=SQR(X)" ; assign to Z the square root of X
15 "Z=INT(X)" ; assign to Z the integer of X
16 "Z=ABS(X)" ; assign to Z the absolute value of X
17 "Z=NEG(X)" ; assign to Z the value of X and change sign of Z
18 "Z=SGN(X)" ; assign to Z the sign function of X
19 "Z= (X)^Y" ; assign to Z the result of X raised to the power of Y
20 "Z=EXP(X)" ; assign to Z the result of e raised to the power of X
21 "Z=LOG(X)" ; assign to Z the common logarithm (base 10) of X
22 "Z= LN(X)" ; assign to Z the natural logarithm of X
23 "Z= PI " ; assign to Z the PI value
24 "Z=RAD(X)" ; assign to Z the radians value of X degrees
25 "Z=DEG(X)" ; assign to Z the degrees value of X radians
26 "Z=SIN(X)" ; assign to Z the sine of X (radians)
27 "Z=COS(X)" ; assign to Z the cosine of X (radians)
28 "Z=TAN(X)" ; assign to Z the tangent of X (radians)
29 "Z=ASN(X)" ; assign to Z the inverse sine of X
30 "Z=ACS(X)" ; assign to Z the inverse cosine of X
31 "Z=ATN(X)" ; assign to Z the inverse tangent of X
32 "Z=RANDOM" ; assign to Z a random integer number between 0 and 255
33 "T$=STR A" ; assign to T$ the value of variable A converted into the equivalent string
34 " LET A=" ; (two lines statement) set the numeric variable A to the following number
"+0.00000" ; 8BASIC standard numeric format is 6 digits plus sign and decimal dot
35 " LET T$=" ; (two lines statement) set the text variable T$ to the following string
"ABCDEFGH" ; 8BASIC standard string format is 8 chars (alphanumeric and special symbols)
36 "LET B==A" ; assign to variable B the numeric value of variable A
37 "K=INKEY$" ; make a program wait until a key is pressed and assign to K the pressed key
38 "INPUT A " ; ask the user to enter the numeric value of variable A
39 "INPUT T$" ; ask the user to enter the string value of variable T$
40 " CLS " ; clears (blank) the 16-segment LED displays and reset (0) the 7-segment ones
41 " CLEAR " ; reset variables to their default type value
42 "PRINT A " ; display the numeric value of variable A
43 "PRINT T$" ; display the string value of variable T$
44 "PRINT+T$" ; display and scroll the strings T$ and consecutives till encountering # char
45 "PAUSE T " ; suspend the program execution. Value of T is the time in ms to pause
46 "BEEP T,F" ; generate a tone. T is the tone duration (ms). F is the tone number (max 7)
47 " IN (A) " ; assign to variable A the binary value input from the 8 bit parallel port
48 " OUT (A)" ; output binary value of variable A to the 8 bit parallel port
49 "A=PEEK X" ; assign to variable A the byte value at the X memory location
50 "POKE X,A" ; write byte value of variable A into X memory location
51 "SYS X " ; branch (and jump back) to the machine language program at the X location
Each statement is precompiled as much as possible to make the interpreter run faster and it always occupies 16 bytes.
Statements allow you extreme flexibility. For example a FOR...TO..NEXT cycle can be easily written as:
LET I=+1.00000
LET U=+1.00000
LET T=number of cycles
N:
cycle
I=I+U
IFT>=I:N
END
Due to the internal RAM memory structure, the maximum size of the 8BASIC program has been set to 488 lines, which will fit the first 8K RAM chip.
Last edited: