Re: [Amforth] Problems with pick

2013-11-10 Thread Keith Amidon
On Sun, 2013-11-10 at 20:22 -0800, Keith Amidon wrote: > I don't have my board handy right now, but I think you'll find... Oops. Somehow the follow-up messages weren't threaded with the original in my mail client so I didn't realize there were a bunch of replies already. Anyway, the explicitly c

Re: [Amforth] Problems with pick

2013-11-10 Thread Keith Amidon
On Sat, 2013-11-09 at 19:42 -0700, craig and heather wrote: > Then I try this subtraction. 1 pick = 300; 3 pick = 100; I expect 200 > > (ATmega328P)> 1 pick 3 pick - . > > 100 ok > > Got 100 as the answer? I don't have my board handy right now, but I think you'll find: > .s 400 300 200 10

Re: [Amforth] Problems with pick

2013-11-10 Thread Tom Harris
There is a moral here: do not try to use the stack as an array where you access values by their indices, since the indices change whenever the stack changes depth. Whether PICK is unforth or not I don't care, but it's use is prone to exactly this sort of error. Like goto in "C", only use when you r

Re: [Amforth] Problems with pick

2013-11-10 Thread Erich Waelde
On 11/10/2013 04:16 AM, craig and heather wrote: > never mind I guess I tired or just an idiot Do not despair --- the stack thing got all of us at least once! :-) Cheers, Erich -- November Webinars for C, C++, Fortran D

[Amforth] Problems with pick

2013-11-09 Thread craig and heather
never mind I guess I tired or just an idiot Sorry -- Craig Lindley -- November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading

[Amforth] Problems with pick

2013-11-09 Thread craig and heather
I just added pick to my amforth executable and unless I'm doing something wrong I think it has a problem. First I push four numbers onto the stack. (ATmega328P)> 100 200 300 400 ok Then I verify what I pushed (ATmega328P)> .s 400 300 200 100 ok Now I use pick to print each number individually