Non-6502: Forth on a 28-pin DIP LPC1114 (ARM)

Topics relating to various Forth models on the 6502, 65816, and related microprocessors and microcontrollers.
Post Reply
scotws
Posts: 576
Joined: 07 Jan 2013
Location: Just outside Berlin, Germany
Contact:

Non-6502: Forth on a 28-pin DIP LPC1114 (ARM)

Post by scotws »

Not for the 6502, but possibly interesting to the other Forthwrights here: Foud a link on Reddit (where there is a forum for Forth) to a "Forth on a DIP" project (http://jeelabs.org/2015/07/22/forth-on-a-dip/). This uses the LPC1114 chip, a 28-pin DIP ARM (http://www.nxp.com/products/microcontro ... 4FN28.html), with Mecrisp Forth (http://mecrisp.sourceforge.net/). The author has a moment of insight:
Quote:
Forth code runs surprisingly fast. Here is a delay loop which does nothing:

: delay 0 do loop ; ok.
And this code:

10000000 delay ok.
… takes about 3.5 seconds before printing out the final “ok.” prompt. That’s some 3 million iterations per second. Not too shabby, if you consider that the LPC1114 runs at 12 MHz!
Well, duh.
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Non-6502: Forth on a 28-pin DIP LPC1114 (ARM)

Post by BigEd »

Edit: Oops, I did misunderstand - there's no repeated function call, so this is a counted but empty loop taking 4 ticks for each time round. Still not much by way of overhead.

[Previously: Am I missing something? That seems quite impressive, for an interpreted language, to call a function in just 4 ticks - even if the function does nothing, doesn't it still have to do the nothing? In effect this Forth is running very close to native speed, which is about as good as it gets.]
Brad R
Posts: 93
Joined: 07 Jan 2014
Contact:

Re: Non-6502: Forth on a 28-pin DIP LPC1114 (ARM)

Post by Brad R »

Looks like Mecrisp compiles directly to native code (machine code), so yes, that is quite possible.
Because there are never enough Forth implementations: http://www.camelforth.com
jmp(FFFA)
Posts: 171
Joined: 23 Sep 2015
Location: Philadelphia, PA

Re: Non-6502: Forth on a 28-pin DIP LPC1114 (ARM)

Post by jmp(FFFA) »

On a related note, there is FlashForth which will run on an 18-pin DIP (Microchip PIC18) among a number of other families.

http://www.flashforth.com/

P.S. Also a short article on FlashForth in the May, 2015 issue of Circuit Cellar.
Martin_H
Posts: 837
Joined: 08 Jan 2014

Re: Non-6502: Forth on a 28-pin DIP LPC1114 (ARM)

Post by Martin_H »

The Parallax Propeller chip has at least three Forth variants on it. The two most popular are PropForth and TachyonForth. PropForth is closer to standard Forths while Tachyon is much faster. I've done two projects in PropForth

Drawbot: https://www.youtube.com/watch?v=1Z5kE-3XzS0

ScaraArm Mk I: https://www.youtube.com/watch?v=14BX50aHDAk

There's also AmForth for several other microcontrollers: http://amforth.sourceforge.net/
Post Reply