home .. forth .. colorforth mail list archive ..

Re: [colorforth] Running the x18 simulator from Xwindows Colorforth?


Ok.  I've been able to get the x18 simulator
and compiler to work from inside ColorForth
for Windows now.  This is what I did.

--- John Drake <jmdrake_98@xxxxxxxxx> wrote:

> Yeah.  That's due to "memory protection" problems.
> If you execute:
> 
> 2 block @
> 
> it crashes.  And since the simulator uses block
> memory for words like "mem" and "memory"...well
> it's bound to crash.  :(

The problem is that the "block" command doesn't
pointing to the right address for 
ColorForthWindows.  For instance if you
have a block 40 that reads like this:

<magenta> foo 0

And then you type:

foo 40 block

You will have two different numbers on the stack.
In native ColorForth those numbers are the same.

So, I put  the following code in block 19:

<magenta> blockofs
: wblock -19 + 256 * fooa + ;

Now every place in the x18 code where there
was a "block" I have "wblock".

The other problem I ran into was the x18
simulator uses block 0x1FFF and 0x2000 for
state vector and memory storage.  But booting
up into ColorForth for Windows you don't have
that many blocks available.  You can "extend"
the number of blocks even at runtime by 
copying blank blocks past the end of the
blocks already allocated.

I created a word "ncopy" to help with this.

: ncopy ( bn- ) for copy 1 + next drop ;

So if your blocks end at 200 and you're 
currently at a blank block, typing:

200 50 ncopy

will append 50 blank blocks to your workspace.

Still, appending almost 8000 blocks seemed
a bit wastefull, so I also modified the 
"state" and "memory" words to point at
blocks 249 and 250.  That seems to work
just as well.
  
> Oh, I've read the Chuck Moore papers on the subject.
> 
>
http://dec.bournemouth.ac.uk/forth/euro/ef01/moore01a.pdf
>
http://dec.bournemouth.ac.uk/forth/euro/ef01/moore01b.pdf

Ok.  I've read it again more carefully this
time.  I think I'm so used to "skimming" large
complex computer documentation that I made the
mistake of "skimming" those papers.  They're
only 3 pages each and if you "skim" you miss
stuff. :)

As a common reference I'll refer to the CF blocks
found here:

http://www.dnd.utwente.nl/~tim/colorforth/tftp/96mb-bs-server+tftpd-ver.2.0.html

So the first step is to load the compiler:

108 load

This also compiles sample code for a "25x
multicomputer" (block 114).  Then load the
simulator:

100 load

At this point you see the register contents
as described by "25x emulator" paper.  
(Except I only see one column of registers
as opposed to 2.  The paper mentioned that
the variable "nc" represents the "number of
computers".  But I don't see that in the
code.  Perhaps that paper is based on a 
different version of the source?)

I can do a single "step" through the code
or n "steps".  This simulator is simpler 
than the F21 simulators Jeff Fox wrote
in that it doesn't show you the individual
"slot" that's about to be executed.  

I'm still not to the point where I can
use this to write any c18 code myself
using this tool.

The T18 compiler/simulator announced on
the IntellaSys website sounds like it
will be a much more powerfull tool.

http://www.intellasys.net/tools/index.php

But the announcement only mentioned
GForth and SwiftForth.  Will a similar
tool for ColorForth be available?

Regards,

John M. Drake

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com