Multitasking in FORTH

GFA, ASM, STOS, ...

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

Post Reply
Moulinaie
Atari Super Hero
Atari Super Hero
Posts: 557
Joined: Wed Feb 01, 2012 9:34 pm

Multitasking in FORTH

Post by Moulinaie »

Hello,

I'm releasing version 0.4.0 of my FORTH that comes with multitasking capabilities.

forth_line1.gif

First, you define threads (with a page, a stack, and a starting code), then thrun enters in multitasking mode.
It's a collaborative system where you hand over to the next thread with the word thnext.
In addition to a personal stack, you can create local variables that allows you to write a unique code pointing at different memory locations according to the current thread.

Two programs are commented on my page:

(English) https://gtello.pagesperso-orange.fr/forth_e.htm#multi
(Français) https://gtello.pagesperso-orange.fr/forth_f.htm#multi

And you can download the last version:

(English) https://gtello.pagesperso-orange.fr/forth_e.htm#down
(Français) https://gtello.pagesperso-orange.fr/forth_f.htm#down

At the top of the page, the updated manual is available!

Guillaume.
You do not have the required permissions to view the files attached to this post.
User avatar
Eero Tamminen
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2834
Joined: Sun Jul 31, 2011 1:11 pm

Re: Multitasking in FORTH

Post by Eero Tamminen »

Long time ago I was very interested in FORTH. On quick look this and the manual look great, much appreciated!
stormy
Atari God
Atari God
Posts: 1360
Joined: Tue Jan 26, 2016 12:39 pm

Re: Multitasking in FORTH

Post by stormy »

Out of interest - I am not a programmer but I understand that different programming languages are usually aimed at different types of applications, like financial or graphical or games or whatever.

I was wondering why an Atari programmer might choose FORTH to write his app over something like GFA Basic, and vice-versa. What would the benefits be in each case for different application types?
Moulinaie
Atari Super Hero
Atari Super Hero
Posts: 557
Joined: Wed Feb 01, 2012 9:34 pm

Re: Multitasking in FORTH

Post by Moulinaie »

stormy wrote: Sat Jun 11, 2022 7:14 pm Out of interest - I am not a programmer but I understand that different programming languages are usually aimed at different types of applications, like financial or graphical or games or whatever.

I was wondering why an Atari programmer might choose FORTH to write his app over something like GFA Basic, and vice-versa. What would the benefits be in each case for different application types?
Two answers are possible... The first one with objective arguments:
- FORTH is easier in a direct mode. For example when you're searching for a solution and build some useful words and try step by step in interactive mode. IIRC it was first designed to control machines in real time.
- FORTH is really compact, few bytes are required, few variables and fast enough.
- FORTH has no syntax or type control, so sometimes you can do things impossible or harder elsewhere.
- About my own version, I tried to make everything easier providing some powerful instructions (Multitasking, dialogs in windows, easy build of dialogs and menus, access to the FPU, graphic modules management, dialog with an external assembler (but everything included in the same source code), etc.
- It is still in developpement!

The other answer is totally subjective:
- FORTH is so different compared to other languages that it's for me a real pleasure to program it. There is a kind of intellectual satisfaction to find the correct stack movements, to optimize routines to avoid variables etc... Every program is a little challenge.

Guillaume.
AnachronyX
Atari freak
Atari freak
Posts: 74
Joined: Sun Mar 08, 2009 12:33 pm

Re: Multitasking in FORTH

Post by AnachronyX »

Guillaume, thanks for your great work :)
User avatar
Eero Tamminen
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2834
Joined: Sun Jul 31, 2011 1:11 pm

Re: Multitasking in FORTH

Post by Eero Tamminen »

Quoting from Wikipedia: https://en.wikipedia.org/wiki/Forth_(pr ... _language)

"Forth has been called a meta-application language: a language that can be used to create problem-oriented languages"

It has been traditionally used in embedded systems and firmware where compactness is important.
Post Reply

Return to “Coding”