NewsProductsSprinterSupportDownloadSprinter ForumAbout usLinksSite map Russian site

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

Pages in this thread: 1 | 2 | (show all)
garrylancaster
(newbie)
2002/07/23 01:07
Re: CamelForth multitasking facilities new [re: Alex_Hot]Reply to this post

Congratulations on the Sokoban conversion - it works really well! I hope you will update it to work with graphics when the next version of CamelForth is released ;)

Just a few comments about the use of windows and tasks...

First, you only really need to define one task (the "C" task for TIMES). RULES only does one thing and then stops, so can just be used after defining window 1 in GAME. Also, SOKOBAN is already running as the main task in GAME, and so shouldn't be running as another task as well (this means you have two SOKOBANs running together, which might do unexpected things!!)

Secondly, the TIMES task is using window 0, since when you do TASK! that was the active window. It would be better to either move the code directly after the definition of window 3 in game, eg:

: GAME
.....
.....
3 WINDOW 11 ATTRIB
66 27 10 3 S" " OPENPOPUP
['] TIMES C TASK!
.....
.....
;

Alternatively, redefine TIMES so that it selects window 3, eg:

: TIMES
3 WINDOW
BEGIN .... PAUSE AGAIN ;

By doing this, you will no longer need to use AT-XY (or always use 0 0 AT-XY to get to the top left of window 3).



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

Alex_Hot
(stranger )
2002/07/25 00:33
Re: CamelForth multitasking facilities new [re: garrylancaster]Reply to this post

Thank you Garry! This is our result! Your help was very useful. :)

So, task (for example TIMES) may be connected to the any already defined window using WINDOW into the redefinition of TIMES word.

And first definition of TIMES before definition of GAME (in your example) mast be like

: TIMES ;

as reserving this word, isn't it?



garrylancaster
(newbie)
2002/07/25 16:13
Re: CamelForth multitasking facilities new [re: Alex_Hot]Reply to this post

> So, task (for example TIMES) may be connected to the any
> already defined window using WINDOW into the redefinition
> of TIMES word.

You don't need to actually define a window (using OPENPOPUP etc) to set the window for a task. The task will either use the current window when TASK! is executed, or it can be specified using WINDOW.

Example 1 (no WINDOW or OPENPOPUP etc used before):
: TIMES BEGIN .... AGAIN ;
' TIMES C TASK!
Task C will use window 0.

Example 2:
: TIMES BEGIN ... AGAIN ;
3 WINDOW
' TIMES C TASK!
0 WINDOW
Task C will use window 3.

Example 3:
: TIMES 5 WINDOW BEGIN ... AGAIN ;
4 WINDOW
' TIMES C TASK!
Task C will start with window 4, but immediately changes to window 5. So, it uses window 5.

> And first definition of TIMES before definition of GAME (in
> your example) mast be like
>
> : TIMES ;
>
> as reserving this word, isn't it?

I don't understand this! Why do you want to define TIMES twice?



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

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

> I don't understand this! Why do you want to define TIMES twice?

I saw your example... :)
Ok. I think, I see my problem. I need info about sequence of definition of a task.
So, is my sequence right?

1. Definition of window.

1 WINDOW 31 ATTRIB
5 5 20 20 S" " OPENPOPUP

2. Definition of TEST word.

: TEST 1 WINDOW BEGIN ... AGAIN PAUSE ;

3. Definition of TEST word as task.

' TEST TASK!

If it is right sequences, can I use some other sequences of definition of a task?








garrylancaster
(newbie)
2002/07/28 00:44
Re: CamelForth multitasking facilities new [re: Alex_Hot]Reply to this post

I probably haven't explained this very clearly! Let's start again ;)

1. CamelForth has 8 windows altogether, number 0-7. These always exist, and you can re-define them at any time using OPENPOPUP etc.

2. Each task has it's own "current window number". It *doesn't* have it's own windows, though; these are shared between all tasks. To set the "current window number" of the running task, use eg 3 WINDOW to set it to 3.

So, if you have your TIMES example running, so it is showing a clock in window 3, try typing the following:

3 WINDOW 0 0 10 3 S" " OPENWINDOW 0 WINDOW

You will see that TIMES outputs its clock to the redefined window at the top left.

So, you can see that when you define the window and when you define the task are not really connected. (Of course, if you WAKE the task before the window it uses is defined, there will be some unexpected results!)

I think the confusion has arisen because I pointed out that when you define a task with TASK! then the new task will use the current window. For example, if you type 3 WINDOW, then from now on any tasks defined with TASK! will also have 3 as their "current window number". Of course, if you include a WINDOW command in the task itself, that will change it.




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

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

Oops! Tasks and windows are not really connected! It was a problem, yes. Thank you very much!



Shaos
(enthusiast)
2002/10/16 09:19
Re: CamelForth multitasking facilities new [re: garrylancaster]Reply to this post

Hello!
I have troubles with emulations your programs (programs made by CamelForth). When SPRINT emulate Sokoban work stopped in moment of keyboard waiting (after Level? prompt). Analize trace of processor don't give me any solutions. So, please, tell me HOW you ask keyboard?


Alexander Shabarshin (shaos@mail.ru)
http://www.shaos.ru

garrylancaster
(journeyman)
2002/10/16 15:41
Re: CamelForth multitasking facilities new [re: Shaos]Reply to this post

Hi,

In single-tasking mode, CamelForth uses the DSS WAITKEY function. In multi-tasking mode, it uses the DSS SCANKEY function.

I think Sokoban runs multitasking, so the SCANKEY function is the one you want.

Garry

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

Shaos
(enthusiast)
2002/10/16 16:02
Re: CamelForth multitasking facilities new [re: garrylancaster]Reply to this post

> I think Sokoban runs multitasking, so the SCANKEY function is the one you want.

I analize full trace (20 Mb) from start to "Level?" message and cycling and I don't found WAITKEY and SCANKEY calls :(
Program simply make cycle inside #CB14 - #E57F with sofisticated code without any calls to DSS or BIOS...


Alexander Shabarshin (shaos@mail.ru)
http://www.shaos.ru

garrylancaster
(journeyman)
2002/10/16 17:14
Re: CamelForth multitasking facilities new [re: Shaos]Reply to this post

> > I think Sokoban runs multitasking, so the SCANKEY
> > function is the one you want.

> I analize full trace (20 Mb) from start to "Level?" message
> and cycling and I don't found WAITKEY and SCANKEY
> calls :(
> Program simply make cycle inside #CB14 - #E57F with
> sofisticated code without any calls to DSS or BIOS...

Here is the code used for multitasking keyboard reading. If you search through memory for the string "CEMIT" you will find this code just before it:

;Z EKEYM -- u get event code from standard input (multi version)
nohead EKEYM,docolon
.ekeym_start
defw PAUSE ; allow other tasks to run
defw ekeym_test
.ekeym_test
push bc ; stack TOS
push iy ; save registers
push ix
ld c,DSS_SCANKEY
rst DSS
pop ix
pop iy
jr nz,mgotakey
pop bc
ld de,ekeym_start
next
.mgotakey
ld a,e
and a
jr nz,mrealkey
ld c,d
ld b,1 ; BC=event
jr mgotevent
.mrealkey
ld c,e
ld b,0 ; BC=key
.mgotevent
jp EXIT ; exit the colon definition



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


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