Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

NEW free 8031 subroutine-threaded Forth available for FTP

106 views
Skip to first unread message

Giovanni Moretti

unread,
Apr 2, 1993, 12:18:22 AM4/2/93
to
Hi

I have made the source and documentation for a 8051 subroutine-
threaded forth available for anonymous FTP on:

FTP site: 130.123.96.9
Directory: giovanni/51forth.zip

I'm Giovanni, the person referred to in the following files.
Scott Gehmlich is the author of this Forth interpreter for the 8031.
He was kind enough to send me these files.

I've tried unsuccessfully several times to contact Scott about making
these files available. He did however, indicate that he was happy for
the files to be freely distributed as long as he was in no way liable.
For his precise wording see the file 51FORTH.DOC.
As usual - IT'S FREE - USE AT YOUR OWN RISK ...

He considers this work to be in the public domain. Because of the
slightly unusual method of the files becoming available, I'm including
the three letters, (the one below, the documentation file and the code
file) in their entirety.

I, unfortunately, can't claim any credit for this work - I'm just the
messenger :-)

Cheers and good luck - let's get a decent forth for the 8031 family
freely available...

Giovanni Moretti G.Mo...@massey.ac.nz
Computer Science Dept Ph +64-6-356-9099
Massey University Fax +64-6-350-5611
Palmerston North, New Zealand

Note that the addresses are OLD - 1989 - email addresses don't work.
-------------------------------------------------------------------------

Date: Thu, 5 Oct 89 17:04:33 MDT
From: scott%idacom%myr...@aunro.AthabascaU.CA
To: GMor...@MASSEY.AC.NZ
Status: RO


Dear Giovanni,

I have a FORTH for the 8031. It is a 16 bit FORTH and since it is
an 8-bit micro, at times it seems a bit awkward. 8-bit FORTH is not very
useful because the addressing is 16-bit. It needs only about 20 words to be
written in assembly code with the remainder written in high level FORTH.
It's implementation is as follows:

Return Stack - I use the 8031 stack for the return stack. It gets
initialized to 7H.

Parameter Stack - I use the remainder of the onboard RAM with R0 as
stack pointer. It gets initialized to 7FH and the
two stacks grow together. The top-of-stack is
actually the data pointer since it is the only
16 bit register on board. This also makes the
fetch's and store's easier.

The register bank is always set to the lower bank ie. addr 0-7 . The other
registers are used for data manipulation etc. All words are created into
offboard RAM and the FORTH runs out this space.

I use battery-backed RAM to save things and on boot up it copies itself into
static RAM. I can, at any time, save the contents of the RAM to BBRAM. It
presently needs just more than 8K Bytes of RAM.

It is a subroutine-threaded FORTH, it has no inner-interpreter and all the
code is executable.

I have a file on a VAX system which I compile onto an RTX2000 FORTH system
which I then copy into some dual ported RAM. Next I flip the switch and the
8031 runs from this RAM. This is the only way I have to compile the actual
kernel because I haven't built a board with a duart on it yet. Once loaded
into the dual ported RAM the 8031 runs stand-alone.

Scott Gehmlich

--------------------------------------------------------------------------

****** Overview of Words in Scott Gehmlick's 51FORTH ****

Full details in the file 51FORTH.DOC


Stack Operators:: SWAP DUP OVER DROP NIP

Memory primitives:: @ ! C@ C!

Arithmetic operators:: + - NOT AND OR XOR 2* 2/ U2/ NEGATE 0<

Return stack primitives:: R>DROP >R R> R I DUP>R (VAR) (CONST) (NEXT)

Control flow primitives:: EXECUTE @+ @- C@+ C@- !+ !- C!+ C!- TUCK ROT
2DUP 2DROP ?DUP

Internal Access:: (IRAM) (IRAMD) (IRAM2) (C@I) (C!I) (BSETI) (BCLRI)
(BCPLI) (B?I) C@I C!I BSETI BCLRI BCPLI B?I

Comparison:: < > U< U> 0= =

Memory Manipulation:: COUNT CMOVE <CMOVE MOVE FILL ERASE BLANKS

Memory Management:: +! HERE ALLOT , C, 1+ 2+

Header Status Bits:: +BITS -BITS LATEST IMMEDIATE SMUDGE RECURSE

Arithmetic operators:: /MOD / MOD U* ABS MAX MIN

State:: ] [

BARON Tasker::

40 QUEUE peasantq address of task queue

>Q ( n \ queue -- ) move 2nd item (n) to next item in (queue)
Q> ( queue -- n ) move next item in (queue) to top item
Q ( queue -- n ) return number (n) of items in (queue)
0Q ( queue -- ) remove all items from (queue)
Q? ( queue -- n ) return YES if queue is not empty, else return NO
BARON ( -- ) execute a task from the peasant queue
>BARON ( cfa -- ) add task to peasant queue
KILL ( cfa -- ) remove all occurances of (cfa) from peasant queue
INLINE_NOP INLINE

Command port primitives:: RX? TX? TX RX

SIO port servicing::
0 VARIABLE sioa-in ( points to queue used to hold input for port a )
0 VARIABLE sioa-out ( points to queue used to hold output for port a )
SIO-PORTA ( -- )
POLL-SIO ( -- )

Terminal Output:: ?WAIT EMIT CR SPACE SPACES TYPE

Numerical Output:: HEX BIN DECIMAL PAD HOLD <# #> SIGN # #S DEPTH .R .

Terminal Input:: KEY? KEY

Parser:: INPUT +IN SKIP SCAN +CHAR PARSE WORD ( COMPILE

Strings:: QUOTE (") " (.") ."

Errors:: SP! RP! ABORT ERROR ?ERROR

Number Conversion:: DIGIT NUMBER XQUOTE X" T"

Dictionary Searching:: C>LINK L>CODE COMPARE SEARCH? FIND? ?FIND

Interpreter:: LITERAL ' INTERPRET

Key collector:: PROMPT PREPARE COLLECTOR

New control loop:: To do with moving data to/from battery backed ram
RESET-INPUT QUIT TOG LOAD SAVE MAP? INIT

Conditionals:: (DO) (LOOP) (+LOOP) IF ENDIF ELSE THEN BEGIN WHILE
AGAIN REPEAT UNTIL FOR NEXT DO LOOP +LOOP LEAVE CASE
{ } ENDCASE

Defining Words:: EXIT FORGET ?UNIQUE CREATE <BUILDS DOES DOES>
VARIABLE CONSTANT TABLE : ; QUEUE

File Loader: FF emitted to request a line of input:: INPUT-LINE LD

Version:: VERSION

Tools:: IN-WHAT .NAME .WORD ?DIR .CODE SEE WORDS WHERE .S .H C.H ?ASCII DUMP

--
-----------------------------------------------------------------------------
Giovanni Moretti * 7 times down, 8 times up * ZL2BOI
G.Mo...@massey.ac.nz Phone +64-6-356-9099 Fax +64-6-350-5611
Computer Science Department, Massey University, Palmerston North, New Zealand

0 new messages