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

No Subject




Raul Miller writes:

>This is a distillation of the steps used to increment then decrement
>the stack pointer.  Let's say that TOS is set to pattern 000001, and
>that the corresponding memory is set to the pattern 12345.  Here's an
>image of what I'd expect in the stack for the above instructions:

with my comments added...

000001         ok 1 on data stack
	a!     store to A is ok without nop in first slot in plastic
	@+     fetch from location 1 put result in T, increment A (by 1)
012345         ok 12345 was in address 1
	a      fetch the valud in A
012345         000002 on top
000006         012345 in second
	dup
012345         000002 (t)
000006         000002 (n)
000006         012345 (s2)
	dup
012345         000002 (t)
000006         000002 (n)
000006         000002 (s2)
000006         012345 (s3)
	-or
012345         000000 (t)
000006         000002 (n)
000000         012345 (s2)
	com
012345         1FFFFF (t) 21 bit -1
000006         000002 (n)
1FFFFF         012345 (s2)
	nop               time for carry to move 8 bits 
012345         1FFFFF (t)
000006         000002 (n)
1FFFFF         012345 (s2)
	+      prefetch in dram is time for 16 more bits, + 8 more bits
               plenty of time for a proper + in DRAM
012345         000001 (t)   2 -1 + => 1
0AAAAb         012345 (n)  still there

In fact 0AAAAB is the PATTERN for NUMBER 000001.  I don't know which tools
you are using to examine the contents of T, but I think the 0AAAAB you refer
to is actually the 000001 that you should see there!

Chuck wrote a dump from PATTERN perspective, Dr. Ting wrote a dump from
NUNBER prespectice.  I keep number perspective in P21Forth.  I do AAAAA XOR
on input and output to and from the outside world to make those look
like numbers even though the hardware uses patterns.  Also the video
coprocessor does us patterns when you deal with its data.  The number
vs pattern perspective problem can get confusing I know.

>Something's not right.  And, I think it's the generation of the -1.
>
>Anyone have a clue what's going on?
>
>Thanks,
>
>Raul D. Miller

It is funny how easy it is to get confused by the fact that Chuck always
thought about patterns because he was designing hardware.  There were
times when he gave talks at the Silicon Valley FIG where he would start
thinking about this outload.  He would say things like "you have too
remember whether you are manipulating a pattern or a number, and if
you perform logic one of the arguments must be a number."  I could see
people's eyes roll in their heads.

Afterwords I would say "Chuck don't say stuff like that! I know you
confused everyone.  I was sure I understood it before you talked about
it, and you made me question whether I understood it!"

It really does go away (for the most part) as seen from P21's perspective.
a 0 is a 0, a 1 is a 1 etc.  

I ran into a similar problem twenty years ago when I did some development
for a machine with a negative logic bus on a machine with positive logic bus.
I had to remember to XOR stuff with FFFF when moving it from one machine
to the other.  No one says the bus must represent a 0 with 0V or a 1 with
+5V, and we get used to thinking it will always be one way, it won't.

Chuck has just added a third catagory, complimentary bus logic, where 
odd bits and even bits use different polarity in hardware.

A positive logic bus machine cannot see that it is postive logic, or a 
negative logic machine cannot see that it has negative logic, nor can
a complimentary bus machine see that it has aa complimentary logic bus 
unless it tries to exchange pattersn with a machine with a different
bus logic.

It is not really a big issue, but it does come in in cross development
on a machine with a different logic bus implementation.  This is also
true of positive and negative logic machines.  It also comes up in
doing i/o to devices that assume positive or negative logic.  And of
course you have a second processor on chip in P21 that does not use
the same representation as the cpu, but that is another issue.

The problem is Chuck's tools, Ting's tools, my tools, your tools, etc
it is easy to just use the wrong perspective until you get used to
what is going on.  As you know the documentation is not perfectly
clear about this.

Dr. Ting's  documentation is the worst I think.  He freely mixes stuff
from Chuck from the pattern perspective with stuff from the number
perspective with no indication which he is using.  THis will certainly
lead to confusion.

As I recall Chuck's binary dump is patterns for data, but numbers for
the addresses.  And of course Chuck likes higher addresses higher on
the screen.  My DUMP is P21Forth is more conventional, it is all
numbers and addresses (same thing) with higher addresses lower on the
screen since it scrolls up.

Jeff Fox