home .. forth .. misc mail list archive ..

number pattern problem error


Dear MISC readers:

I was looking at some ancient MuP21 code in the P21 Programmers
manual.  I did not remember what the 8 bit boot code looked
like on the first release of OK.  It was very ugly.  I looked
at my boot code in the online ok source at my site.  The code
wasn't much better.  I remembered the various different versions
we did over the years. I remembered what Chuck said about the
ugly 8 bit boot code at the time.

He said the 8 bit assembler and enviroment is just ugly because
he just wanted to make it easy to make.  It wasn't important
to make the 8 bit programming eligant because he only needed
to execute a few bytes out of ROM to boot into main memory
and then it should run from there.  It was find a version
that worked, forget about it, move on to important things.  

Also when prototyping chips you have to experiment and see
which instructions work and which instructions don't in 
8 bit mode as well as 20 bit mode but since it is not the
main intended programming environment and all we need to
do is have some canned code that works to boot, it doesn't
have to look good.  We have more important things.  And
we did.

Later people wrote different more eligant versions of
the 8 bit boot code that had much of the same stuff as in 
the 20 bit part to make their boot code look as nice as
the rest of their code.  Chuck did that too.  Other
people just used canned code as a sort of binary image
and wanted to focus their efforts elsewhere.

I have sent out various more modern copies of the 8 bit
boot code, some nicer looking than others.  I wanted
to test on F21 the use of 8 bit mode more generally and
so have done versions for F21.  I have sent them out
on request to people working on P21.  All you have to
do is change the target opcodes and instruction mask
and it changes from F21 to P21 code.  I did find the
C0 (branch on no carry) did not work on F21 in the
8 bit instruction set when trying apply a nice
generalized Forth compiler to it.

now on to the subject of the post:

I said something wrong about the number pattern problems.  I realized 
that I said something wrong here the other day about the number
pattern thing and all that AAAAAh xor stuff. I forgot the worst thing
about it IMHO!  (I discussed it with Chuck the last time I
talked to him too...) 

I was very wrong when I said that the only consequence of the
number/pattern viewpoint thing was a couple of lines of code on
the I/O port or in a cross compiler.  I wish.  

I should have said, the consequence of the number/pattern
viewpoint thing is a couple of lines of code on logical manipulation
of I/O data.  Not just the PPort on F21, but also I/O coprocessors
including video!  The I/O coprocessor control registers (1 only on
P21) operate by patterns.  To manipulate them with CPU logic
you have do AAAAA operations on them.  But this is also true
for video data and instructions.  You can move them without
mucking with this (except in cross development) but if you
manipulate them, AND, OR, or XOR pixels or branch addresses
you must use number/pattern conversion. 

The biggest problem is that it adds complexity to manipulating video.
I meant to say I/O data including coprocessor data.  So I made an
error that gave a wrong impression when I said "I/O port".

In any event, once you have added line of code to the right place
in each routine that must have it you just don't think about it
anymore.  Well I think about it from time to time when thinking
of potential changes.  And I talk to Chuck about it.  I would
prefer to not have that between the CPU and coprocessors when
more than just moving data between is involved in their
interaction.  It has no effect on serial or network or video
data transfers, but it is a rough edge when it comes to
manipulating graphics.

Once you have the line of code here and there to do it where
you need to you really _want_ to forget about it.  If you try
to think about any more than you need to it can confuse you
like a house of mirrors.  It becomes a fraction of a percent 
of a fraction of a percent of what you are doing and you
do tend to forget about it.  

But for those working at the low levels and not using
code written by other people you do have do deal with it.
If your not doing video on P21 you don't have to think
about it at all except for that one control register.
If you are not doing cross development you don't have
to deal with it.  But if you have to figure out where
it might or might not bite you and then debug your
code to figure out if you got it right it can rattle
your brain for sure.  

That is also why I left it out of the P21 simulator and
call it physcal and logical modes in the metacompiler and
documentation.  I wanted people to figure out the CPU,
as I did first.  I wanted to figure out the video but I
had to start with the CPU first.

The later simulators and emulators done for I21 and F21
emulated the full memory spaces and various coprocessors
as well as external components connected to the processors
for particular applications.  It would be pretty easy
to port an F21 version with full memory spaces and video
emulation to the P21 instruction set.  I donated the original
P21 simulator and later F21 simulator and emulator and
anyone who wants to is certainly welcome to upgrade the
free tools to provide simple and obvious visual demonstration to
a user of how every little fiddly bit operates under the
hood.  And of course other people could make variations that
provide program verification, profiling, tracking and
any level of debugging because it is just a simulation.  The
other nice thing is that these donated tools are free and
allow people to play and write real code and get some
of their questions answered for free.

finally:

I have had some business associates who got useful information
from my web site and didn't have to ask me for it, and I have had
some business associates who have participated in the misc
mail list, some lurking, some occasionally giving very
well informed answers to people asking questions.  

But for the most part my postings to the misc mail list, c.l.f,
and the inforation at my web site (about the history of Forth,
the history of the chips, OKAD, the free tools, the transcriptions
of Chuck's presentations about good Forth, the info on
Machine Forth and Chuck's new Color Forth, and my essays
on what is good Forth or on our culture in general) have
been nothing more than my attempting to give away to the 
public the most valuable thing I can, information and
knowledge that I came across the hard way that might
bring other people to a higher level of understanding
and benefit them. 

But giving away free stuff for years does not obligate one
to continue to give away anything.  I am under no obligation
to provide free information to anyone or maintain a web
site or whatever.  As I have told people for years if I
focus on one UT customer in particular, which when and
if the situation presents itself. may be crucial to a
financial sucess for UT and may very likely mean I
will no longer be donating the web site or time to the
public.  If you want any of the junk there don't miss
your chance.  I am under no obligation to keep it there
or to present anything here.

Jeff Fox
UltraTechnology