Post Reply 
RPL beginner
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
Post Reply 


Messages In This Thread
RPL beginner - dwesti - 10-30-2021, 07:23 PM
RE: RPL beginner - David Hayden - 11-01-2021, 02:11 PM
RE: RPL beginner - dwesti - 11-01-2021, 04:40 PM
RE: RPL beginner - DavidM - 11-02-2021, 10:51 AM
RE: RPL beginner - dwesti - 11-02-2021, 02:18 PM
RE: RPL beginner - dwesti - 11-02-2021, 05:20 PM
RE: RPL beginner - DavidM - 11-04-2021, 01:07 AM
RE: RPL beginner - dwesti - 11-04-2021, 09:21 AM
RE: RPL beginner - DavidM - 11-04-2021, 09:49 AM
RE: RPL beginner - dwesti - 11-04-2021, 04:04 PM
RE: RPL beginner - DavidM - 11-05-2021 10:12 AM
RE: RPL beginner - dwesti - 11-06-2021, 06:41 PM
RE: RPL beginner - DavidM - 11-07-2021, 01:38 PM
RE: RPL beginner - dwesti - 11-08-2021, 05:40 PM
RE: RPL beginner - DavidM - 11-11-2021, 02:33 AM
RE: RPL beginner - dlidstrom - 11-13-2021, 08:04 PM
RE: RPL beginner - BINUBALL - 11-14-2021, 02:06 AM
RE: RPL beginner - DavidM - 11-14-2021, 12:49 PM



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