gnupic: GPAL loops bug?
Subject:
Re: GPAL loops bug?
From:
####@####.####
Date:
26 Oct 2004 18:48:18 +0100
Message-Id:
On Wed, Oct 27, 2004 at 02:24:59AM +1300, David McNab wrote:
> Hi,
>
> I'm trying to implement a delay function in GPAL, for instance:
>
> procedure delay is
>
> counter : uint24;
>
> begin
> counter = 0xfffff;
> while counter > 0
> loop
> counter = counter - 1;
> end loop;
>
> end procedure;
>
> But when I call the procedure, no looping happens.
> Ditto if I use a 'for' loop. I've also tried nesting levels of loop
> using only uint8. I've tried pretty much everything, but still gpal is
> generating code which doesn't loop.
>
> (I'm running latest CVS).
>
> Any ideas?
How do you know "no looping happens" ?
Use sucessive refinement:
1. start with the simplest possible code-piece,
2. be able to bebug/analyse right down to hex instructions level.
Your chosen routine is near minumum, but could be simplified to:
'loop forever'.
Then perhaps: 'loop forever while stepping-an-output'.
By so doing you isolate the 'looping' and the decrementing.
And then you could introduce the 'testing' "while counter > 0".
== Chris Glur.
PS. does any one know if Miniature cards [flash] are accessed
parallel random like normal RAM or serial.
PSS. write the routine in picforth [and share by posting here]
together with the resulting 'asm' and hex-code(s).