Sigh - sheepishly read that I can't even spell "There" correctly. - double 
sigh.

On Wednesday 13 October 2004 12:13 pm, Paul Seamons wrote:
> Their is an example at http://www.parrotcode.org/examples/ that returns a
> list of integers that span two integers.  The return types appear to be set
> wrong in the SPAN bsr.  It seems the return values should be
>
>         set     I0, I7  # number of items on the stack
>         set     I1, 0 # no integer return values
>
> The current example is listed below.  I am very much a novice at reading
> PASM so hopefully I didn't interpret the program wrong.
>
> Paul Seamons
>
> PS - By the way the new examples (I think they are new - they are new to
> me) are very nice and descriptive of PASM.
>
> --------------------------------------------------------------
>         set     I0, 1 # prototyped
>         set     I1, 0 # no items on the stack
>         set     I5, 42
>         set     I6, 56
>         bsr     SPAN
>         ne      I0, 0, RETURNERROR # item on stack
>         # we don't know the number of integers values returned
>         ne      I2, 0, RETURNERROR # string return values
>         ne      I3, 0, RETURNERROR # PMC return values
>         ne      I4, 0, RETURNERROR # numeric return values
>
> MORE:   restore I2
>         print   I2
>         print   " "
>         dec     I1
>         if      I1, MORE
>         print   "\n"
>         end
>
> RETURNERROR:
>         print   "Error with return values from SPAN!\n"
>         end
>
> SPAN:   ne      I0, 1, CALLERROR # not prototyped
>         ne      I1, 0, CALLERROR # items on stack
>
>         set     I7, 0 # count of integers
> REDO:   save    I6
>         dec     I6
>         inc     I7
>         le      I5, I6, REDO
>
>         set     I0, 0  # no items on the stack
>         set     I1, I7 # one integer return value
>         set     I2, 0  # no string return values
>         set     I3, 0  # no PMC return values
>         set     I4, 0  # no numeric return values
>         ret
>
> CALLERROR:
>         print   "Error calling SPAN!\n"
>         end
> --------------------------------------------------------------

Reply via email to