Just built my first Z80 system and at some point I want to port CP/M over to
it.
However, to begin with I'd like to stick a small version of BASIC in ROM.
Does anybody have source code (Either Z80 or 8080) that can be run ROM? I've
searched the net but could only find versions that have been made to work
under CP/M
Cheers,
Dave
--
=== Beware Of Spam Trap ===
Dave (@) Coldfusion (.) fsnet (.) co (.) uk
> Does anybody have source code (Either Z80 or 8080) that can be run ROM? I've
> searched the net but could only find versions that have been made to work
> under CP/M
There was a TDL basic interpreter that could run from ROM, IIRC.
Its size was 12k. I should have the binaries in relocatible form,
but not the sources.
--
Dipl.-Ing. Tilmann Reh
Autometer GmbH Siegen - Elektronik nach Maß.
http://www.autometer.de
==================================================================
In a world without walls and fences, who needs Windows and Gates ?
(Sun Microsystems)
Hi
I have a copy of tiny basic that runs on a Poly-88 ( S-100, 8080 ).
It fits into a 2716 or two 2708's. You just need to patch in
something different for the cons-in/cons-out and make
the changes you need in addresses. I think I only have the text
in list form but that can be edited down to source. It is
an implementation of Palo Alto Tiny Basic( the one that started
DDJ ).
It has the ability to patch in new commands to extend the
operations. I can add examples of PEEK, POKE, and a tape
SAVE. The tape SAVE uses the Poly's routines but it is useful
as an example of how to add commands. You'll need to wait
till monday for me to dig it out.
I assume your address is correct without the obvious extras.
Dwight
I for one would like to have a copy. I would assume others would like to
have a copy for their collection. Maybe someone can put it on a web/ftp
site.
I would like to have a copy to add to my collection. Maybe someone can put
peter
peter....@chello.at
"Randy McLaughlin" <ra...@nospam.com> schrieb im Newsbeitrag
news:flUDa.33680$0E3....@fe03.atl2.webusenet.com...
"Randy McLaughlin" <ra...@nospam.com> wrote in message news:<flUDa.33680$0E3....@fe03.atl2.webusenet.com>...
---snip---
Thanks for the reply
| I have a copy of tiny basic that runs on a Poly-88 ( S-100, 8080 ).
| It fits into a 2716 or two 2708's. You just need to patch in
| something different for the cons-in/cons-out and make
| the changes you need in addresses. I think I only have the text
| in list form but that can be edited down to source. It is
| an implementation of Palo Alto Tiny Basic( the one that started
| DDJ ).
| It has the ability to patch in new commands to extend the
| operations. I can add examples of PEEK, POKE, and a tape
| SAVE. The tape SAVE uses the Poly's routines but it is useful
| as an example of how to add commands. You'll need to wait
| till monday for me to dig it out.
That sounds ideal. All the versions of Tiny BASIC I have found so far have
required CP/M to run and have been modified with disk load/save commands
| I assume your address is correct without the obvious extras.
It is :)
This file was retyped from the "PCC's REFERENCE BOOK", published
in 1977, by Emmanuel ROCHE, who ported PATB to the Amstrad
PCW8256 (PCWPATB.ASM) circa 1986...
Palo Alto Tiny BASIC Version Three (PATB v3)
==================================
by LI-CHEN WANG
---------------
Palo Alto Tiny BASIC (PATB) is one of the implementations of
Tiny BASIC proposed in "People's Computer Company Newspaper" and
"Dr. DOBB's Journal". However, there are some differences
between the original proposal and PATB.
a) FOR-NEXT loop is implemented in PATB.
b) PRINT format control is implemented in PATB.
c) PATB uses semicolons (";") to separate commands (instead
of MBASIC's ":") , and commas (",") to separate items in
the same command. E.g.: 120 INPUT A,B,C;LET
D=5,E=7;PRINT F,G,H
d) Compare operators can be used in any expression, not
restricted to IF command.
e) PATB allows prompt strings in the INPUT command.
Furthermore, if the input is not valid, the prompt is
automatically repeated until a valid input is keyed in.
f) PATB command keywords may be abbreviated.
Version 1.0 of PATB was published in "Dr. DOBB's Journal"
(Vol.1, No.5). Version 2.0 was published in "Interface Age"
(Vol.2, No.1). The version presented here (Version 3.0) differs
from the previous ones in that:
a) The RST instructions are no longer used as CALL's. This
makes the program longer, but enables one to relocate
the program to anywhere in the address space. (RST
instructions call subroutines on Page Zero.)
b) A few JMP instructions are inserted, so that the user
can extend PATB by changing these JMP's.
c) Some other small changes in PRINT command.
d) In Version 1.0, there are two known bugs: FOR I=1 TO
32767 will never end, and ABS(-32767-1) gives a negative
result. In Version 2.0, there is one known bug: ABS(0)
gives an error. These bugs are fixed in Version 3.0.
THE LANGUAGE
============
NUMBERS
-------
All numbers are integers, and must be between -32767 and 32767.
VARIABLES
---------
There are 26 variables, denoted by letters A through Z. There is
also a single array @(I). The dimension of the array (i.e., the
range of values of the index I) is set automatically to make use
of all the memory space that is left unused by the program
(i.e., 0 through SIZE/2, see SIZE function below.)
FUNCTIONS
---------
Without extension, there are only 3 functions. More functions
can be added as extensions.
ABS(X) Gives the absolute value of X.
RND(X) Gives a random number between 1 and X (inclusive).
SIZE Gives the number of bytes left unused by the program.
ARITHMETIC AND COMPARE OPERATORS
--------------------------------
/ divide. (Note that, since we have integers only, 2/3=0.)
* multiply.
- subtract.
+ add.
> (compare) greater than.
< (compare) less than.
= (compare) equal to. (Note that, to certain versions of
BASIC, 'LET A=B=0' means 'set both A and B to 0'. To
this version of Tiny BASIC, it means 'set A to the
result of comparing B with 0'.)
# (compare) not equal to. (MBASIC uses "<>".)
>= (compare) greater than or equal to.
<= (compare) less than or equal to.
+, -, *, and / operations result in a value between -32767 and
32767. (-32768 is also allowed in some cases.) The result of any
comparison is 1 if True, 0 if not True (False).
EXPRESSIONS
-----------
Expressions are formed with numbers, variables, and functions
with arithmetic and compare operators between them. + and -
signs can also be used at the beginning of an expression. The
value of an expression is evaluated from left to right, except
that * and / are always done first, + and - next, and compare
operators the last. Parentheses can also be used to alter the
order of evaluation.
STATEMENTS
----------
A Tiny BASIC statement must consist of a statement number
between 1 and 32767, followed by one or more commands. Commands
in the same statement are separated by a semi-colon (";"). GOTO,
STOP, and RETURN commands must be the last command in any given
statement.
PROGRAM
-------
A Tiny BASIC program consists of one or more statements. When a
direct command RUN is issued, the statement with the lowest
statement number is executed first, then the one with the next
lowest statement number, etc. However, the GOTO, GOSUB, STOP and
RETURN commands can alter this normal sequence. Within the
statement, execution of the commands is from left to right. The
IF command can cause the execution of all commands to its right
in the same statement to be skipped.
COMMANDS
--------
Tiny BASIC commands (unextended) are listed below with examples.
More commands can be added as extensions. Remember that commands
can be concatenated with semicolons (";"). In order to store the
statement, you must also have a statement number in front of the
commands. The statement number and the concatenation are not
shown in the examples.
REM or REMARK command
---------------------
REM causes the interpreter to ignore the rest of the line. This
allows the programmer to put remarks in the program.
LET command
-----------
LET A=234-5*6, A=A/2, X=A-100, @(X+9)=A-1
will set the variable A to the value of the expression 234-5*6
(i.e., 204), set the variable A (again) to the value of the
expression A/2 (i.e., 102), set the variable X to the value of
the expression A-100 (i.e., 2), and then set the variable @(11)
to 101 (where 11 is the value of the expression X+9, and 101 is
the value of the expression A-1).
LET U=A#B, V=(A>B)*X+(A<B)*Y
will set the variable U to either 1 or 0, depending on whether A
is not equal to or is equal to B, respectively; and set the
variable V to either X, Y or 0, depending on whether A is
greater than, less than, or equal to B, respectively.
PRINT command
-------------
PRINT A*3+1, 'AB"123', "#'!@%"
PRINT A*3+1, 'AB"123', "#'!@%",
The first command will print the value of the expression A*3+1
(e.g., 307), the string of characters ABC"123, and the string
#'!@%, and then start a new line. Note that either single (') or
double (") quotes can be used to quote strings, but pairs must
be matched. The second command (ending with a ",") will produce
the same output as the first, except that it will not start a
new line after the last item is printed. This enables the
program to continue printing on the same line with another PRINT
command.
Numerical values are printed with leading blanks, so that they
take 8 spaces each. This field width can be changed by a # sign
followed by a number indicating the new width. The new width
will be effective until the end of this PRINT command, unless
changed again by #n. Note that no trailing space is printed.
Extra spaces can be generated by repeated commas.
PRINT A, #3, B,,, C+1,
This will print the value of A in 8 spaces, the value of B in 3
spaces (more if B > 999 or B < -99), two extra spaces, and the
value of C+1 in 3 spaces (more if C > 998 or C < -100).
PRINT ^L, ^K, ^I
This command will print the control characters FF (Control-L),
VT (Control-K), and HT (Control-I). Control characters can also
appear inside quotes, but the method used here makes them
visible in the program listing.
INPUT command
-------------
INPUT A, B
When this command is executed, Tiny BASIC will print A, a space,
and wait to read in an expression from the keyboard. The
variable A will be set to the value of the input expression.
Then B is printed with a space, and variable B is set to the
value of the next expression read from the keyboard.
INPUT 'WHAT IS YOUR WEIGHT?'A, "YOUR HEIGHT?"B
This is the same as the command above, except the prompt: A is
replaced by: WHAT IS YOUR WEIGHT?, and the prompt: B is replaced
by: YOUR HEIGHT?. Again, both single (') and double (") quotes
can be used, as long as they are matched.
In both of the above examples, if the input (at run time) from
the keyboard is not a valid expression, Tiny BASIC will reprint
the prompt and wait again until a valid expression is entered.
One may also choose to reprint only part of the prompt, e.g.:
INPUT "WHAT IS ", "YOUR WEIGHT?"A, "YOUR HEIGHT?"B
In this case, WHAT IS YOUR WEIGHT? will be asked the first time;
while only the part YOUR WEIGHT? will be repeated if an invalid
input is given.
IF command
----------
IF A<B LET X=3; PRINT 'THIS STRING'
will test the value of the expression A<B. If it is not zero
(i.e., if it is True), the commands in the rest of this
statement will be executed. If the value of the expression is
zero (i.e., if it is not True, hence False), the rest of this
statement will be skipped and execution continues at the next
statement. Note that the word "THEN" is not used.
GOTO command
------------
GOTO 120
will jump to statement 120 and proceed from that statement on.
Note that GOTO command cannot be followed by a semicolon (";")
and other commands. It must be ended with a CR. (Be the last
command on a line.)
GOTO A*10+B
will jump to a statement number as computed from the value of
the expression and proceed from that point on.
GOSUB and RETURN commands
-------------------------
GOSUB command is different from GOTO command in that: a) the
current statement number and position within the statement is
remembered; and b) a semicolon (";") and other commands can
follow GOSUB in the same statement.
GOSUB 120
will cause the execution to jump to statement 120.
GOSUB A*10+B
will cause the execution to jump to the statement as computed
from the given expression A*10+B.
RETURN
A RETURN command must be the last command in a statement,
followed by a CR. (Be the last command on a line.) When a
RETURN command is encountered, execution will jump back to the
command following the most recent GOSUB command.
GOSUB can be nested. The depth of the nest is limited only by
the stack space.
FOR and NEXT commands
---------------------
FOR X=A+1 TO 3*B STEP C-1
The variable X is set to the value of the expression A+1. The
values of the expressions (not the expressions themselves) 3*B
and C-1 are remembered. The name of the variable X, the
statement number and the position of this command within the
statement are also remembered. Execution then continues the
normal sequence until a NEXT command is encountered.
The STEP can be positive, negative and even zero. The word STEP
and the expression following it can be omitted if the desired
STEP is +1.
NEXT X
The name of the variable (X) is checked with that of the most
recent FOR command. If they do not agree, that FOR is terminated
and the next recent FOR is checked, etc. When a match is found,
this variable will be set to its current value plus the value of
the STEP expression saved by the FOR command. The updated value
is then compared with the value of the TO expression also saved
by the FOR command. If this is within the limit, execution will
jump back to the command following the FOR command. If this is
outside the limit, execution continues following the NEXT
command itself.
FOR can be nested. The depth of the nesting is limited only by
the stack space. If a new FOR command with the same control
variable as that of an old FOR command is encountered, the old
FOR will be terminated automatically.
STOP command
------------
STOP
This command stops the execution of the program, and returns
control to direct commands from the input device. It can appear
many times in a program, but must be the last command in any
given statement; i.e., it cannot be followed by semicolon (";")
and other commands.
DIRECT COMMANDS
---------------
As defined earlier, a statement consists of a statement number
followed by commands. If the statement number is missing, or if
it is 0, the commands will be executed (instead of saved) after
you have typed the CR. All commands described above can be used
as direct commands. There are three more commands that can be
used as direct commands, but not as part of a statement:
RUN
will start execution of the program starting at the lowest
statement number.
LIST
will print out all statements in ascending numerical order.
LIST 120
will print out the statements starting at statement 120.
LIST 120, 5
will print out 5 lines starting at statement 120.
NEW
will delete all statements.
STOPPING THE EXECUTION
----------------------
The execution of program, or listing of program, can be stopped
by typing Control-C.
ABBREVIATION AND BLANKS
-----------------------
You may use blanks freely, except that numbers, command
keywords, and function names can not have embedded blanks.
You can truncate all command keywords and function names with a
period. 'P.', 'PR.', 'PRI.', and 'PRIN.' all stand for 'PRINT'.
Also, the word LET in LET command can be omitted. The 'shortest'
abbreviation for all keywords are as follows:
A. = ABS
F. = FOR
GOS. = GOSUB
G. = GOTO
IF = IF
IN. = INPUT
. = LIST
N. = NEW
. = NEXT
P. = PRINT
REM = REMARK
R. = RETURN
R. = RND
R. = RUN
S. = SIZE
S. = STEP
S. = STOP
TO = TO
(implied) = LET
ERROR REPORT
------------
There are only three error conditions in Tiny BASIC. The
statement that contains an error is printed out with a question
mark inserted at the point where the error is detected.
(1) WHAT? means it does not understand you.
Example:
WHAT
210 P?TINT "THIS"
where PRINT is mistyped.
WHAT?
260 LET A=(B+3?, C=3+4
where a close parenthesis is missing.
(2) HOW? means it understands you, but does not know how to do it.
HOW?
310 LET A=B*C?+2
where B*C is larger than 32767.
HOW?
380 GOTO 412?
where statement 412 does not exist.
(3) SORRY means it understands you and knows how to do it, but
there is not enough memory to do it.
ERROR CORRECTIONS
-----------------
If you notice an error in typing before you hit the CR, you can
delete the last character by the BS (Control-H) key.
To correct a statement, you can retype the statement number with
the correct commands. Tiny BASIC will replace the old statement
with the new one.
To delete a statement, type the statement number followed
immediately by a CR.
EOF
Take a look at http://www.dunfield.com/downloads.htm and download the
file BASIC85.ZIP. This contains Dave Dunfield's Tiny BASIC source code.
This version (and the included monitor) goes in a single 4k EPROM.
--
Lee A. Hart Ring the bells that still can ring
814 8th Ave. N. Forget your perfect offering
Sartell, MN 56377 USA There is a crack in everything
leeahart_at_earthlink.net That's how the light gets in - Leonard Cohen
Hi Lee,
Thanks for that - Very usefull. Managed to port it over and get it running
within an hour or so!!
> > There was a TDL basic interpreter that could run from ROM, IIRC.
> > Its size was 12k. I should have the binaries in relocatible form,
> > but not the sources.
>
> I would like to have a copy to add to my collection. Maybe someone
> can put it on a web/ftp site.
I have just put it on my site:
http://www.autometer.de/files/TDLBASIC.ARC
This file also contains disk I/O routines for CP/M.
I'm sorry that I don't have any documentation left, but it really
is a full-featured BASIC interpreter.
Very much appreciated.
The indefatigable "French Luser" Emannual Roche has typed in some
documentation he found for TDL BASIC, and posted it a while back on
comp.os.cpm. I don't know how to search for old posts, but if someone
does I'll bet it could be found.
-Frankie
Thanks, Lee. You are too kind. I am red faced, now!
Seriously, 2 things to mention:
1) Emmanuel is written this way. It is a 3,000 years old
Hebrew word meaning "the Elected One" (by God).
It was used by Prophet Isaie as a synonym for "the Messiah".
That's why, every Christmas, Catholic priests say: "Emmanuel
will come." during the midnight mass.
2) Herb Johnson sells photocopies of original TDL doc.
Two of those docs appear to deal with the "12KB TDL BASIC"
that we are talking about. They may be more complete that
the notes that I had retyped.
While we are on this 12KB TDL BASIC: it was done outside
of CP/M. It does not expect anything special in Page Zero.
However, it starts at 0600H, so can be loaded as a CP/M
COMmand file. The documentation explains the subroutines
needed (kind of "Char In" and "Char Out"). It was also done
to run on an ASR-33 Teletype, hence the NULL command,
specifying the number of NULLs (00H bytes) to send after
a CR/LF while the Carriager was going back to the start of
the next line.
Recently, it was mentioned several times that its authors,
Roger Amidon and Neil Colvin, were still alive.
Unfortunately, they never released the source code
of their many famous program (starting with their
famous Z-80 Macro Assembler...).
Finally, I happen to have its disassembly.
But, if you just want to play with a little Tiny BASIC,
I think that the source code of Palo Alto Tiny BASIC
(published by error in another thread) would be better.
Yours Sincerely,
"French Luser"