Post Reply 
RPL beginner
10-30-2021, 07:23 PM
Post: #1
RPL beginner
I am studying RPL, but it turned out that the program does not work after checking the conditions
tell me where is the error
Code:

ASSEMBLE
    NIBASC    /HPHP48-D/
RPL
*
* Begin the secondary
*
::

  RECLAIMDISP        ( *Claim the alpha display* )
  ClrDA1IsStat        ( *Temporarily disable clock* )

  ZEROZERO        ( #0 #0 )
  150 64 MAKEGROB    ( #0 #0 150x150grob )
  XYGROBDISP        (  )
  TURNMENUOFF        ( *Turn off menu line* )
*
* Remember that LINEON requires
* requires #x2>#x1! 131x64
*
 %0 %0 %0 %0 %0 %0 %0 %0
 {
  LAM X1
  LAM Y1
  LAM X2
  LAM Y2
  LAM DX1
  LAM DY1
  LAM DX2
  LAM DY2
 } BIND

 0 ' LAM X1 STO
 0 ' LAM Y1 STO

 1 ' LAM DX1 STO
 1 ' LAM DY1 STO

 120 ' LAM X2 STO
 53 ' LAM Y2 STO
 
 BEGIN
 KEYINBUFFER? NOT
 WHILE
 LAM X1
 LAM Y1
 LAM X2
 LAM Y2
 LINEON        ( *Draw line* )

 LAM X1
 LAM Y1
 LAM X2
 LAM Y2
 LINEOFF

 LAM Y1
 LAM DY1
  #+
( DUP )
  ' LAM Y1 STO

( execution stops )
( IF 60 == THEN )
( 0 ' LAM Y1 STO )
( END )


 REPEAT
 WaitForKey
 ABND
*      ::
;
Find all posts by this user
Quote this message in a reply
11-01-2021, 02:11 PM
Post: #2
RE: RPL beginner
I don't know why the program doesn't work, but you could replace this:
Code:
 %0 %0 %0 %0 %0 %0 %0 %0
 {
  LAM X1
  LAM Y1
  LAM X2
  LAM Y2
  LAM DX1
  LAM DY1
  LAM DX2
  LAM DY2
 } BIND

 0 ' LAM X1 STO
 0 ' LAM Y1 STO

 1 ' LAM DX1 STO
 1 ' LAM DY1 STO

 120 ' LAM X2 STO
 53 ' LAM Y2 STO
with this:
Code:
ZERO ZERO 120 FIFTYTHREE ONE ONE %0 %0

 LAM X1
  LAM Y1
  LAM X2
  LAM Y2
  LAM DX1
  LAM DY1
  LAM DX2
  LAM DY2
 } BIND
Find all posts by this user
Quote this message in a reply
11-01-2021, 04:40 PM
Post: #3
RE: RPL beginner
thanks, this way works. It remains to figure out the condition
Code:

if y1>60 then dy1=-dy1 endif
Find all posts by this user
Quote this message in a reply
11-02-2021, 10:51 AM
Post: #4
RE: RPL beginner
Welcome to the world of System RPL programming! There are usually meaningful rewards to be had over standard (User) RPL programs, but the "price to pay" for these rewards is in understanding the more type-specific nature of the commands and the structures provided.

Looking at your program, several things stood out that may need consideration. I'll mention a few here that may help you.

1) Start all System RPL programs with one of the "check" commands. It sets the stage for how the error-handling system in the calculator should attempt to repair the initial stack objects if/when an error occurs in your code. Not all System RPL errors are recoverable, but this is the minimum you should do and it's a good habit to always include this in every System RPL program. In your case, there are no arguments needed by the program. So you should start with CK0NOLASTWD.

2) The GROB you create at the beginning of the program is blank, and you are then displaying it in the blank text display (which was cleared with RECLAIMDISP). This doesn't create a problem, but it serves no particular purpose. I've left that code out of my example since it doesn't contribute to the outcome here. I've also not included the LAMs that aren't used in this example in an effort to reduce distractions.

3) As was pointed out by David Hayden, you may as well just initialize the LAMs you create with their default values. That saves you the trouble of having to assign the initial values later as a separate step.

4) You've set up your indefinite loop to use a keypress as an exit condition. This is a good way to experiment with something like this, and I would suggest extending it one step further: also check for the user pressing the ON (CANCEL) key. This is a natural and intuitive exit case, and requires very little extra code to support it. Also, you don't really need to do anything with the keys which are pressed, so you should probably just ignore them instead of bringing the values to the stack. My example shows one way to do this.

5) Finally, the "check condition" that you are asking about. I've shown one way of doing this in my example, but there's more to it than is obvious in the code. While I believe the code I've provided does what you are suggesting, BINTs are actually not signed values. The reason this works is more a consequence of what happens naturally if you add two unsigned values where the carry would extend through all of the initial (high-order) bits. MINUSONE is defined (in hex notation) as FFFFF. But as a BINT, that actually has a value of (decimal) 1048575 instead of -1. Try the following program to see what I mean:
Code:
::
   CK0NOLASTWD

   "ONE is "

   ONE MINUSONE #>

   ITE "greater" "less" &$

   " than MINUSONE." &$
;

I hope this will give you a good start for further experimentation.

Code:
::
   ( no arguments expected )
   CK0NOLASTWD

   ( setup/clear display )
   ClrDA1IsStat
   RECLAIMDISP
   TURNMENUOFF

   ( allocate locals )
   ZEROZERO
   120 FIFTYTHREE
   ONE
   {
      LAM X1
      LAM Y1
      LAM X2
      LAM Y2
      LAM DY1
   } BIND

   ( clear key buffer )
   FLUSHKEYS
   ATTNFLGCLR

   ( loop until a key is pressed )
   BEGIN
      KEYINBUFFER? ATTN? OR NOT
   WHILE
      ( draw line )
      LAM X1 LAM Y1
      LAM X2 LAM Y2
      LINEON

      ( clear line )
      LAM X1 LAM Y1
      LAM X2 LAM Y2
      LINEOFF

      ( change DY1 value if appropriate )
      LAM Y1 SIXTY #> IT ::
         MINUSONE
         ' LAM DY1 STO
      ;

      ( change Y1 value )
      LAM Y1 LAM DY1 #+
      ' LAM Y1 STO
   REPEAT

   ( clear pressed key )
   FLUSHKEYS
   ATTNFLGCLR

   ( abandon locals )
   ABND

   ( reset display )
   ClrDAsOK
;
Find all posts by this user
Quote this message in a reply
11-02-2021, 02:18 PM
Post: #5
RE: RPL beginner
Thanks for the help. The most difficult thing for me was the correctness of the commands. Now one more condition does not work
Code:

      ( change DX1 value if appropriate )
      LAM X1 120 #> IT ::
         0 LAM DX1 #-
         ' LAM DX1 STO

is it possible to combine validation with OR?
Find all posts by this user
Quote this message in a reply
11-02-2021, 05:20 PM
Post: #6
RE: RPL beginner
right now, but the manual says that when drawing a line, you need to call ORDERXY#, then the line draws incorrectly
Code:

ASSEMBLE
    NIBASC    /HPHP48-D/
RPL

::
   ( no arguments expected )
   CK0NOLASTWD

   ( setup/clear display )
   ClrDA1IsStat
   RECLAIMDISP
   TURNMENUOFF

   ( allocate locals )
   ZERO ZERO
   110 50
   ONE ONE
   ONE ONE
   {
      LAM X1
      LAM Y1
      LAM X2
      LAM Y2
      LAM DX1
      LAM DY1
      LAM DX2
      LAM DY2
   } BIND

   ( clear key buffer )
   FLUSHKEYS
   ATTNFLGCLR

   ( loop until a key is pressed )
   BEGIN
      KEYINBUFFER? ATTN? OR NOT
   WHILE
      ( draw line )
      LAM X1 LAM Y1
      LAM X2 LAM Y2
(      ORDERXY# )
      LINEON

      ( clear line )
      LAM X1 LAM Y1
      LAM X2 LAM Y2
(      ORDERXY# )
      LINEOFF

      ( change Y1 value )
      LAM Y1 LAM DY1 #+
      ' LAM Y1 STO

      ( change DY1 value if appropriate )
      LAM Y1 SIXTY #> IT ::
        MINUSONE
         ' LAM DY1 STO
      ;
      LAM Y1 #0= IT ::
         ONE
         ' LAM DY1 STO
      ;

      ( change Y2 value )
      LAM Y2 LAM DY2 #+
      ' LAM Y2 STO

      ( change DY2 value if appropriate )
      LAM Y2 SIXTY #> IT ::
         MINUSONE
         ' LAM DY2 STO
      ;
      LAM Y2 #0= IT ::
         ONE
         ' LAM DY2 STO
      ;

      ( change X1 value )
      LAM X1 LAM DX1 #+
      ' LAM X1 STO

      ( change DX1 value if appropriate )
      LAM X1 120 #> IT ::
        MINUSONE
         ' LAM DX1 STO
      ;
      LAM X1 #0= IT ::
         ONE
         ' LAM DX1 STO
      ;

   REPEAT

   ( clear pressed key )
   FLUSHKEYS
   ATTNFLGCLR

   ( abandon locals )
   ABND

   ( reset display )
   ClrDAsOK
;
Find all posts by this user
Quote this message in a reply
11-04-2021, 01:07 AM
Post: #7
RE: RPL beginner
(11-02-2021 05:20 PM)dwesti Wrote:  right now, but the manual says that when drawing a line, you need to call ORDERXY#, then the line draws incorrectly

ORDERXY# does more than simply swapping the X/Y pairs if X1>X2. It also swaps Y1 and Y2 in certain situations, which you definitely don't want for this. Here's how it is defined:
Code:
::
  4PICK 3PICK #>
  IT 2SWAP

  3PICKOVER #>
  IT SWAPROT
;

Everything up to (and including) the 2SWAP command is what you need in this situation; the rest of it should not be performed. There's no way to remove the excess from the built-in command, so I'd recommend just including that initial code where needed or possibly creating a subroutine with those commands to call.

There's also the possibility of using the DRAWLINE#3/TOGGLELINE#3 pair of commands instead of LINEON/LINEOFF. The former pair has a built-in check for X values to make sure it can draw the line appropriately, whereas the latter does not. That would obviously require you to change the code around so that it uses the graphics display (PICT) instead of the text display, but that's not too difficult. SysRPL programs should save the existing PICT data before making any changes, though, since that data is considered to be "owned" by the user and is expected to be left intact by most programs.
Find all posts by this user
Quote this message in a reply
11-04-2021, 09:21 AM
Post: #8
RE: RPL beginner
Now no lines are drawn. added to entries.a
Find all posts by this user
Quote this message in a reply
11-04-2021, 09:49 AM
Post: #9
RE: RPL beginner
(11-04-2021 09:21 AM)dwesti Wrote:  Now no lines are drawn. added to entries.a

What changes did you make? What did you add to entries.a? It's difficult to know what's going on without more details.
Find all posts by this user
Quote this message in a reply
11-04-2021, 04:04 PM (This post was last modified: 11-04-2021 04:06 PM by dwesti.)
Post: #10
RE: RPL beginner
I used rplcomp and sasm
Code:

DRAWLINE#3    EQU #50758 *
TOGGLELINE#3    EQU #5072B *

file attached


Attached File(s)
.zip  ld.zip (Size: 1.05 KB / Downloads: 4)
Find all posts by this user
Quote this message in a reply
11-05-2021, 10:12 AM
Post: #11
RE: RPL beginner
There are two main "displays" for RPL calculators: the main stack display (alpha/text) and the graph display (graph/PICT). Built-in drawing commands that aren't designed for use with stack-based GROBs are usually specific to either the alpha display (ADISP) or the graph display (GDISP).

Your original code used LINEON and LINEOFF, which draw/clear lines only on the alpha display. DRAWLINE#3 and TOGGLELINE#3 draw/toggle lines only on the graph display. The calculator has to be manually switched to the graph display in order to see the results of DRAWLINE#3 and TOGGLELINE#3.

As you might expect, there are different commands for clearing/saving/restoring the two displays. I've taken the program from your zip file and edited it slightly to accommodate using the graph instead of the alpha display. I also added a short pause between the line-drawing and toggling steps to make the animation cleaner on an emulated calculator. If that step (% 0.02 dowait) slows things down too much, just remove it. No other changes were made from your posted code:
Code:
::
   ( no arguments expected )
   CK0NOLASTWD

*   ( setup/clear display )
*   ClrDA1IsStat
*   RECLAIMDISP
*   TURNMENUOFF

   ( save User PICT on stack )
   GBUFF TOTEMPOB

   ( clear PICT )
   ZEROZERO MAKEPICT#

   ( activate fullscreen PICT display )
   TOGDISP
   TURNMENUOFF

   ( allocate locals 131x64)
   TEN TEN
   120 SIXTY
   FIVE ZERO
   ZEROZERO
   {
      LAM X1
      LAM Y1

      LAM X2
      LAM Y2

      LAM DX1
      LAM DY1

      LAM DX2
      LAM DY2
   } BIND

   ( clear key buffer )
   FLUSHKEYS
   ATTNFLGCLR

   ( loop until a key is pressed )
   BEGIN
      KEYINBUFFER? ATTN? OR NOT
   WHILE
      ( draw line )
      LAM X1 LAM Y1
      LAM X2 LAM Y2

      DRAWLINE#3

      % 0.02 dowait

      LAM X1 LAM Y1
      LAM X2 LAM Y2

      TOGGLELINE#3

      ( change Y1 value )
      LAM Y1 LAM DY1 #+
      ' LAM Y1 STO

      ( change X1 value )
      LAM X1 LAM DX1 #+
      ' LAM X1 STO

      ( change Y2 value )
      LAM Y2 LAM DY2 #+
      ' LAM Y2 STO

      ( change X2 value )
      LAM X2 LAM DX2 #+
      ' LAM X2 STO

      ( change DX1 value if appropriate )
      LAM X1 130 #= IT ::
          MINUSONE
        ' LAM DX1 STO
      ;
      LAM X1 #0= IT ::
         ONE
         ' LAM DX1 STO
      ;

      ( change DY1 value if appropriate )
      LAM Y1 SIXTY #= IT ::
         MINUSONE
         ' LAM DY1 STO
      ;
      LAM Y1 #0= IT ::
         ONE
         ' LAM DY1 STO
      ;

      ( change DY2 value if appropriate )
      LAM Y2 SIXTY #= IT ::
         MINUSONE
         ' LAM DY2 STO
      ;
      LAM Y2 #0= IT ::
         ONE
         ' LAM DY2 STO
      ;

      ( change DX2 value if appropriate )
      LAM X2 130 #= IT ::
         MINUSONE
         ' LAM DX2 STO
      ;
      LAM X2 #0= IT ::
         ONE
         ' LAM DX2 STO
      ;

   REPEAT

   ( clear pressed key )
   FLUSHKEYS
   ATTNFLGCLR

   ( abandon locals )
   ABND

   ( switch back to alpha display )
   TOADISP

   ( restore user PICT )
   GROB>GDISP

   ( reset display )
   ClrDAsOK
;

Hope this helps!
Find all posts by this user
Quote this message in a reply
11-06-2021, 06:41 PM
Post: #12
RE: RPL beginner
thanks for the help. But the program that I wrote in Apple 2 works differently.


Attached File(s)
.zip  drw2.zip (Size: 34.7 KB / Downloads: 6)
Find all posts by this user
Quote this message in a reply
11-07-2021, 01:38 PM
Post: #13
RE: RPL beginner
OK, it's now more obvious where you are headed with this animation. Very well done!

Using TOGGLELINE#3 worked with the previous versions of your code, given that there was only one line being drawn at the time. In the previous scenario, TOGGLELINE#3 would just clear the line that was just drawn. I would suggest that TOGGLELINE#3 is no longer appropriate with this most recent update, though, as it leaves stray pixels active in locations where previously-drawn lines overlap with previously-cleared lines.

The original use of LINEON/LINEOFF now appears to be the better approach. That being the case, you could keep the drawing on the alpha display instead of switching to the graph display. This would negate the need to save the user PICT area and switch to that display, as well as correctly turning off all of the appropriate pixels for each previous line. Using LINEON/LINEOFF requires the occasional reordering of input pairs, though, so that requirement needs to be accommodated in the code. This seems like a good time to introduce the use of a subroutine.

Calling subroutines in the context of an RPL library is very straightforward, but that's out-of-scope for this situation. Here, I would suggest doing it in a very similar manner to what you might do with a UserRPL implementation: save the subroutine as a local variable, then recall/EVAL it as needed for execution.

I've taken your most recent code and modified it as follows:
  • formatted some of the commands more "horizontally" to provide visual cues about the grouping
  • switched back to using the text/alpha display for drawing
  • created a line-drawing subroutine for drawing and clearing lines

I believe this provides a more faithful rendering of the animation that you originally intended.

Code:
::
   ( no arguments expected )
   CK0NOLASTWD

   ( setup/clear display )
   ClrDA1IsStat
   RECLAIMDISP
   TURNMENUOFF

   ( place line drawing subroutine on the stack )
   ' ::
      (
         DrwLn: Given line endpoints and a boolean, draws or clears the line
                designated by the endpoints in the text/alpha display.

         Input
            SL5: X1
            SL4: Y1
            SL3: X2
            SL2: Y2
            SL1: TRUE [draw] or FALSE [clear]

         Output
            Draws or clears a line in alpha/text display
      )
      5UNROLL                    ( move boolean to top of args )
      4PICK 3PICK #> IT 2SWAP    ( order endpoints as needed )
      5ROLL ITE LINEON LINEOFF   ( draw or clear line )
   ;

   ( allocate locals 131x64)
   90 30       ( x1=90 y1=30 )
   60 0        ( x2=50 y2=10 )
   5 -5        ( dx1 dy1 )
   -5 5        ( dx2 dy2 )

   10 10       ( x3=10 y3=10 )
   120 40      ( x4=120 y4=50 )
   5 5         ( dx3 dy3 )
   5 5         ( dx4 dy4 )
   {
      LAM DrwLn

      LAM X1   LAM Y1
      LAM X2   LAM Y2
      LAM DX1  LAM DY1
      LAM DX2  LAM DY2
      LAM X3   LAM Y3
      LAM X4   LAM Y4
      LAM DX3  LAM DY3
      LAM DX4  LAM DY4
   } BIND

   ( clear key buffer )
   FLUSHKEYS ATTNFLGCLR

   ( loop until a key is pressed )
   BEGIN
      KEYINBUFFER? ATTN? OR NOT
   WHILE
      ( draw current line )
      LAM X1 LAM Y1
      LAM X2 LAM Y2
      TRUE
      LAM DrwLn EVAL

      ( brief pause for emulator )
      % 0.02 dowait

      ( clear previous line )
      LAM X3 LAM Y3
      LAM X4 LAM Y4
      FALSE
      LAM DrwLn EVAL

      ( change Y3 value )
      LAM Y3 LAM DY3 #+
      ' LAM Y3 STO

      ( change X3 value )
      LAM X3 LAM DX3 #+
      ' LAM X3 STO

      ( change Y4 value )
      LAM Y4 LAM DY4 #+
      ' LAM Y4 STO

      ( change X4 value )
      LAM X4 LAM DX4 #+
      ' LAM X4 STO

      ( change Y1 value )
      LAM Y1 LAM DY1 #+
      ' LAM Y1 STO

      ( change X1 value )
      LAM X1 LAM DX1 #+
      ' LAM X1 STO

      ( change Y2 value )
      LAM Y2 LAM DY2 #+
      ' LAM Y2 STO

      ( change X2 value )
      LAM X2 LAM DX2 #+
      ' LAM X2 STO

      ( change DX4 value if appropriate )
      LAM X4 130 #= IT ::
          -5
        ' LAM DX4 STO
      ;
      LAM X4 #0= IT ::
         5
         ' LAM DX4 STO
      ;

      ( change DY4 value if appropriate )
      LAM Y4 SIXTY #= IT ::
         -5
         ' LAM DY4 STO
      ;
      LAM Y4 #0= IT ::
         5
         ' LAM DY4 STO
      ;

      ( change DX3 value if appropriate )
      LAM X3 130 #= IT ::
          -5
        ' LAM DX3 STO
      ;
      LAM X3 #0= IT ::
         5
         ' LAM DX3 STO
      ;

      ( change DY1 value if appropriate )
      LAM Y3 SIXTY #= IT ::
         -5
         ' LAM DY3 STO
      ;
      LAM Y3 #0= IT ::
         5
         ' LAM DY3 STO
      ;

      ( change DX1 value if appropriate )
      LAM X1 130 #= IT ::
          -5
        ' LAM DX1 STO
      ;
      LAM X1 #0= IT ::
         5
         ' LAM DX1 STO
      ;

      ( change DY1 value if appropriate )
      LAM Y1 SIXTY #= IT ::
         -5
         ' LAM DY1 STO
      ;
      LAM Y1 #0= IT ::
         5
         ' LAM DY1 STO
      ;

      ( change DY2 value if appropriate )
      LAM Y2 SIXTY #= IT ::
         -5
         ' LAM DY2 STO
      ;
      LAM Y2 #0= IT ::
         5
         ' LAM DY2 STO
      ;

      ( change DX2 value if appropriate )
      LAM X2 130 #= IT ::
         -5
         ' LAM DX2 STO
      ;
      LAM X2 #0= IT ::
         5
         ' LAM DX2 STO
      ;

   REPEAT

   ( clear pressed key )
   FLUSHKEYS ATTNFLGCLR

   ( abandon locals )
   ABND

   ( reset display )
   ClrDAsOK
;
Find all posts by this user
Quote this message in a reply
11-08-2021, 05:40 PM
Post: #14
RE: RPL beginner
Looks good. Probably the size of the program can be reduced by using arrays
Find all posts by this user
Quote this message in a reply
11-11-2021, 02:33 AM
Post: #15
RE: RPL beginner
(11-08-2021 05:40 PM)dwesti Wrote:  Probably the size of the program can be reduced by using arrays

Suggestion:

Instead of an array, consider using NULL-named LAMs. They are fast to access, can be of any type, and are flexible to use with built-in commands. They are much like an array but are in some ways more convenient.

The following sample implementation introduces the following SysRPL concepts:
  • NULLLAMs instead of named LAMs
  • definite loops
  • case statements (when checking for boundary conditions)
  • use of DEFINEs to improve the readability of the code
Note that when defining NULLLAMs, the objects need to be placed on the stack in the reverse order of their index. This is due to the natural consequence of stack level numbering starting at 1 with the most recently added object. Since the LAM indices match the stack level numbers when the LAMs were created, the last item added to the stack is the one indexed as NULLLAM 1.

Code:
DEFINE   X1                1GETLAM
DEFINE   X2                2GETLAM
DEFINE   X3                3GETLAM
DEFINE   X4                4GETLAM
DEFINE   Y1                5GETLAM
DEFINE   Y2                6GETLAM
DEFINE   Y3                7GETLAM
DEFINE   Y4                8GETLAM
DEFINE   TotalLAMs         SEVENTEEN
DEFINE   DrawOrClearLine   17GETLAM EVAL
::
   ( no arguments expected )
   CK0NOLASTWD

   ( setup/clear display )
   ClrDA1IsStat
   RECLAIMDISP
   TURNMENUOFF

   ( subroutine for line drawing/clearing )
   ' ::
      (
         DrwLn: Given line endpoints and a boolean, draws or clears the line
                designated by the endpoints in the text/alpha display.

         Input
            SL5: X1
            SL4: Y1
            SL3: X2
            SL2: Y2
            SL1: TRUE [draw] or FALSE [clear]

         Output
            Draws or clears a line in alpha/text display
      )
      5UNROLL                    ( move boolean to top of args )
      4PICK 3PICK #> IT 2SWAP    ( order endpoints as needed )
      5ROLL ITE LINEON LINEOFF   ( draw or clear line )
   ;

   ( initial values for NULLLAMs )
   ( note: reverse order [stack index aligned] )

   ( DY values [DY4 - DY1] )
   FIVE FIVE FIVE -5

   ( DX values [DX4 - DX1] )
   FIVE FIVE -5 FIVE

   ( Y values [Y4 - Y1] )
   FORTY TEN ZERO THIRTY

   ( X values [X4 - X1] )
   120 TEN SIXTY 90

   ( bind locals )
   ' NULLLAM TotalLAMs NDUPN DOBIND

   ( clear key buffer )
   FLUSHKEYS ATTNFLGCLR

   ( loop until a key is pressed )
   BEGIN
      KEYINBUFFER? ATTN? OR NOT
   WHILE
      ( draw current line )
      X1 Y1
      X2 Y2
      TRUE
      DrawOrClearLine

      ( brief pause for emulator )
      % 0.02 dowait

      ( clear previous line )
      X3 Y3
      X4 Y4
      FALSE
      DrawOrClearLine

      ( step values )
      NINE ONE_DO (DO)
         INDEX@               ( X/Y index )
         DUP #8+              ( DX/DY index )
         OVER GETLAM          ( X/Y value )
         OVER GETLAM #+DUP    ( add DX/DY value, DUP )
         4PICK PUTLAM         ( PUT new X/Y value )

         ( check for step delta change )
         ::
            ZERO OVER#=case ::            ( current X/Y value is 0 )
               FIVE 3PICK PUTLAM          ( DX/DY should change to 5 )
            ;
            3PICK FIVE #< ITE 130 SIXTY   ( determine upper value change point )
            OVER#=case ::                 ( current X/Y value is max point )
               -5 3PICK PUTLAM            ( DX/DY should change to -5 )
            ;
         ;

         ( drop 3 BINTs on stack [X/Y index, DX/DY index, new X/Y value] )
         3DROP
      LOOP

   REPEAT

   ( clear pressed key )
   FLUSHKEYS ATTNFLGCLR

   ( abandon locals )
   ABND

   ( reset display )
   ClrDAsOK
;
Find all posts by this user
Quote this message in a reply
11-13-2021, 08:04 PM
Post: #16
RE: RPL beginner
Impressive work DavidM, I was following along all different versions. You explain well and know SysRPL very well. Do you have any programs published at hpcalc.org? Are you actively programming SysRPL?

HP48GX, HP48GX, 128KB ram card, DM42
Find all posts by this user
Quote this message in a reply
11-14-2021, 02:06 AM
Post: #17
RE: RPL beginner
(11-13-2021 08:04 PM)dlidstrom Wrote:  Impressive work DavidM, I was following along all different versions. You explain well and know SysRPL very well. Do you have any programs published at hpcalc.org? Are you actively programming SysRPL?
This is his profile at hpcalc.org.
https://www.hpcalc.org/authors/2279

S.Korean / 50G | fx-570EX | 200LX
Visit this user's website Find all posts by this user
Quote this message in a reply
11-14-2021, 12:49 PM
Post: #18
RE: RPL beginner
(11-13-2021 08:04 PM)dlidstrom Wrote:  Do you have any programs published at hpcalc.org? Are you actively programming SysRPL?

Thanks for following along, dlidstrom. This app provided a nice platform for showing some specific SysRPL concepts.

In addition to the performance and functional advantages, I actually find SysRPL to be easier to code than UserRPL sometimes. It has its quirks, to be sure, but that's just part of the fun of it. Most of the coding I do for a calculator is written in SysRPL and targeted for a 50g these days.

I've got a couple of contributed projects at hpcalc.org (MultiStopwatch and the ListExt library), and a few other contributions that Eric was kind enough to include that came from postings here and at comp.sys.hp48.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)