[comp.sys.handhelds] The Continuing Adventures of Maxwell Smart

ksmith@jarthur.claremont.edu (Karl J. Smith) (04/24/91)

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

stevev@greylady.uoregon.edu (Steve VanDevender) (04/24/91)

The extra binary integer you sometimes see results when you
interrupt SMART just after it has called TICKS.  Note that the
value left on the stack is right in the range of TICKS for your
current time.
--
Steve VanDevender 	stevev@greylady.uoregon.edu
"Bipedalism--an unrecognized disease affecting over 99% of the population.
Symptoms include lack of traffic sense, slow rate of travel, and the
classic, easily recognized behavior known as walking."

ksmith@jarthur.Claremont.EDU (Karl J. Smith) (04/24/91)

In article <STEVEV.91Apr23233830@greylady.uoregon.edu> stevev@greylady.uoregon.edu (Steve VanDevender) writes:
>The extra binary integer you sometimes see results when you
>interrupt SMART just after it has called TICKS.  Note that the
>value left on the stack is right in the range of TICKS for your
>current time.

Oops. You're right.

The other point I made - that the values returned by SMART alternate
between two distinct times - is still 'strange', I think. It's probably some
artifact of the grabage collector.

>--
>Steve VanDevender 	stevev@greylady.uoregon.edu
>"Bipedalism--an unrecognized disease affecting over 99% of the population.
>Symptoms include lack of traffic sense, slow rate of travel, and the
>classic, easily recognized behavior known as walking."

-Karl Smith                    ksmith@jarthur.claremont.edu