Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!usc!jarthur!jarthur.claremont.edu From: ksmith@jarthur.claremont.edu (Karl J. Smith) Newsgroups: comp.sys.handhelds Subject: The Continuing Adventures of Maxwell Smart (stack oddities) Message-ID: <11874@jarthur.Claremont.EDU> Date: 24 Apr 91 02:12:32 GMT Sender: ksmith@jarthur.Claremont.EDU Organization: Harvey Mudd College, Claremont, CA 91711 Lines: 59 The Continuing Adventures of Maxwell Smart... A while back I posted an anecdote about discovering that my 48 was running at roughly half speed, and that an ON-A-F reset fixed it. I was using this program to test it: %%HP: T(3)A(R)F(.); @ SMART, so named because it should produce @ 86 (or something close) on the stack: \\<< MEM DROP @ do garbage collection TICKS \-> $$$ \<< @ save current tick count @ no EVAL here this time TICKS @ get tick count when done $$$ - B\->R @ compute ticks elapsed @ with no EVAL, the actual elapsed @ time (86) is just the time it takes to assign $$$ and get here @ if we do nothing at this point, we'll have 86 on the stack \>> \>> Well, once I was running at normal speed again, I started to poke around with the stack, to see what I could do to it. I typed this in on the stack, and EVAL'd it: \<< WHILE 1 REPEAT SMART END \>> Program #2 I stopped it with ATTN, and ended up with a bunch of numbers on the stack increasing from 86 to 88, with larger values the longer I let it run. This was expected. What was not expected was that *sometimes* I also got an extra binary integer on the stack, that shouldn't be there, such as this: # 1D431242660F2h or #1D431244507D0h or #1D431244EC4B7h Where is it coming from? It's different every time. Maybe it's the address of the top of the stack? The three #'s above are from three consecutive runs of program #2, with the stack growing up to a 'time' of 102. The other thing I discovered was that if you put enough stuff on the stack, by letting program #2 run for a while, the time it takes SMART to run alternates between two values, like this: 658 640 658 640 658 641 etc... (This is with a stack depth of 2844. Last stack, arg, and command are on, but you get similar results with all three turned off, too.) -Karl Smith ksmith@jarthur.claremont.edu