[OpenBIOS] [PATCH] Add tbu@ and tbl@ words
Segher Boessenkool
segher at kernel.crashing.org
Sat Dec 30 12:18:02 CET 2017
On Fri, Dec 29, 2017 at 10:30:17PM -0500, Programmingkid wrote:
>
> > On Dec 29, 2017, at 8:01 PM, BALATON Zoltan <balaton at eik.bme.hu> wrote:
> >
> > I've tried to implement it the way I've suggested and came up with the
> > patch below, but it does not seem to work. I think this is because the
> > arithmetic in get-msec overflows and does not get the right values. Could
> > it be it works in SLOF because that runs on 64bit? Or is something needed
> > to tell Forth to use 64bit values on PPC32? Any ideas?
>
> I continuously printed the tb@ word's value by using this program:
>
> decimal
> begin
> tb@ . .
> cr
> again
>
> The tbu value looks right. The tbl value is a problem. When it prints it sometimes prints as a negative value.
You should use U. .
> printf("or'ed value: %" PRId64 "\n", (uint64_t)((tbu << 32) | tbl)); // should be 8,294,967,296
And that should be (uint64_t)tbu << 32 (note where the cast is done).
Segher
More information about the OpenBIOS
mailing list