NewsProductsSprinterSupportDownloadSprinter ForumAbout usLinksSite map Russian site

English
   >> Software programming for the computer Sprinter
Thread views: 328 View all threadsNext thread*Threaded Mode

Pages in this thread: 1 | 2 | (show all)
Alex_Hot
(stranger )
2002/07/04 21:31
CamelForth multitasking facilities Reply to this post

I tried to use multitasking for monitoring of data stack by ".S" word, which work as another task.
And I have failed, certainly. Next I read, that different tasks use different data stacks, ets...
But any way, is it possible to transfer values between stacks of different tasks?





garrylancaster
(stranger )
2002/07/05 02:55
Re: CamelForth multitasking facilities new [re: Alex_Hot]Reply to this post

It's not really possible to examine the stacks of other tasks, because even though I could tell you how to find where the stack is, it would also contain different items depending upon when the task was suspended (with a PAUSE, during EKEY or MS etc).

If you want to try an example, here is an idea for an exercise: create a task that displays a clock in a window (in the top-right corner?) and updates it whenever the minute changes. You can use the ANS standard word TIME&DATE to get the time (assuming you have a real-time clock chip).

When using multitasking/multiprogramming in Forth, there are two usual ways to pass data between tasks:

1. Don't (no communication!)
2. Use VARIABLEs/VALUEs

For the clock example, there is no need to pass any data.

As another example, I wrote a text/graphics adventure system for the Z88 in CamelForth. This uses a separate task to draw the pictures, while the rest of the adventure continues. The only communication is when starting the task: a picture address is stored into a variable, then the task is started, which takes the address from the variable and starts drawing the picture. No further communication is needed, because the picture task will STOP when it has finished. The main program doesn't know (or care) if this has happened (but it could find out by checking if the task was AWAKE?), because it simply sets the same task to draw a new picture when required, or stops it if the game finishes.


--
Garry Lancaster
http://www.z88forever.org.uk/zxplus3e/
http://www.z88forever.org.uk/

Alex_GoryachevAdministrator
(Sprinter Team)
2002/07/10 20:05
Re: CamelForth multitasking facilities new [re: garrylancaster]Reply to this post

There is interesting effect when two active windows place at the same part of screen. Sometimes a task from the first window print in the another window during scrolling.

---
PETERS PLUS LTD

Alex_Hot
(stranger )
2002/07/10 20:20
Re: CamelForth multitasking facilities new [re: Alex_Goryachev]Reply to this post

BTW if the second (in your example) window contain task of cleaning window (PAGE word) this effect will be more seldom. Why?



garrylancaster
(stranger )
2002/07/11 15:28
Re: CamelForth multitasking facilities new [re: Alex_Goryachev]Reply to this post

This is to be expected; it's not a good idea to have overlapping windows. If you want two tasks to use the same screen area, just use the same window.

--
Garry Lancaster
http://www.z88forever.org.uk/zxplus3e/
http://www.z88forever.org.uk/

Alex_Hot
(stranger )
2002/07/15 19:39
Re: CamelForth multitasking facilities new [re: garrylancaster]Reply to this post

I ported the Sokoban game using ANS sources. It was not a difficult. I did some changes for more comfortable playing.
But I have a problem with usage of multitasking and windows after compile an EXE program
During usage a game in interpreter mode all is ok. Three tasks work in different windows (Rules of the game, game screen and time window).
But when I execute EXE program of this game all windows has fullscreen size with defoult attributes.
Usage/unusage of CINIT was not a solution. It's same result.
BTW v4.01 not cleaning a screen after starting.



garrylancaster
(newbie)
2002/07/15 19:56
Re: CamelForth multitasking facilities new [re: Alex_Hot]Reply to this post

It sounds like you have defined your windows during compilation of the program. Since all windows are set to the full screen when CamelForth starts, you must make sure that you define them in a word executed at initialisation, probably by the word that is set to (COLD). See the notes at the end of saveexe.txt.

The behaviour of v4.01 is so that it's easy to make command-line programs. If you don't like that, try this (from save-exe documentation):

' CAMEL IS (COLD)
S" camel.exe" SAVE-EXE

If you still have trouble, email me your sources and I will try to tell you what you are doing wrong ;-)

--
Garry Lancaster
http://www.z88forever.org.uk/zxplus3e/
http://www.z88forever.org.uk/

Alex_Hot
(stranger )
2002/07/16 20:02
Re: CamelForth multitasking facilities new [re: garrylancaster]Reply to this post

Thanks for the help! Sokoban works correctly now. I hope you will see it soon.










Alex_Hot
(stranger )
2002/07/18 20:28
Attachment
Re: CamelForth multitasking facilities new [re: garrylancaster]Reply to this post

I see Sokoban in Download page now. Well, I hope it will be not a best variant of this cool game on the Sprinter. ;)
I attached an image of one maze from the game. It's not a screenshot, certainly, but it like maze image on the Sprinter screen.
There are several changes in this variant of the game.
A special window for the maze image.It means Play without scroll of the game screen after each step (as in GForth on PC).
Clock window, which will work if your Sprinter has RTC CMOS chip.
Another wall image.
Another control keys.
Separated levels files. You can change, add,delete it in text editor.
Choice of start level of the game.



Alex_Hot
(stranger )
2002/07/18 21:16
Re: CamelForth multitasking facilities new [re: garrylancaster]Reply to this post

Some unrealized features in the Sokoban.
1. Changing of the Soko symbol (@) and boxes ($).
2. I couldn't made an again choice of level during the game without exit.
3. Usage of a text mode 40x32 with special font.
4. Choice of levels files before game start.




Pages in this thread: 1 | 2 | (show all)
View all threadsNext thread*Threaded Mode
Jump to