Okay, hmm. It seems to be because even when I store a value of $80 in
PORTA, if I read it right back like that I'm getting a word. Which is
actually what I'm asking it for by using @. So I would read back $ED80.
Changing it to use the byte size  c* and c! was the problem there.

Thanks,
Mark

On Sat, Sep 19, 2020 at 9:55 AM George Herzog <jackalopete...@gmail.com>
wrote:

> It's a common display situation in Forth. Leading zeros aren't display,
> even when they exist.
>
> On Sat, Sep 19, 2020, 2:24 AM Mark Roth <cablegu...@gmail.com> wrote:
>
> > Is there a reason that when using rshift or 2/ the most significant bit
> > isn't zero padded? lshift and 2* do this correctly. I was trying to
> > implement a simple back and forth led on a port by starting with a value
> of
> > 1 in the the port. Moving from right to left in the port works perfectly
> > but when moving from left to right using either rshift or 2/ every other
> > bit is set high so after a couple of back and forths the port is filled
> > with 1s.
> >
> > I can see that the lshift says it is zero padded but the rshift doesn't
> say
> > that it is. Is there a reason for this? The 2012 specs seem to say that
> > rshift is zero padded as well.
> > http://lars.nocrew.org/forth2012/core/RSHIFT.html
> >
> > Perhaps it's just my noob code that is the problem.
> >
> > : cylon
> > >     $ff ddra ! 1 porta !
> > >     begin 40 ms
> > >         8 0 do porta @ 2* porta ! 40 ms loop
> > >         8 0 do porta @ 2/ porta ! 40 ms loop
> > >     key? until ;
> >
> >
> > It appears to work correctly in one direction but not the other.
> >
> > Thanks,
> > Mark
> >
> > _______________________________________________
> > Amforth-devel mailing list for http://amforth.sf.net/
> > Amforth-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/amforth-devel
> >
>
> _______________________________________________
> Amforth-devel mailing list for http://amforth.sf.net/
> Amforth-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>

_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to