Post Reply 
Surprise graphic program (HP-48G, GX)
10-28-2014, 07:21 AM (This post was last modified: 10-28-2014 07:00 PM by Gerson W. Barbosa.)
Post: #1
Surprise graphic program (HP-48G, GX)
Here is a simple graphic program for the HP-48G,GX (it should work on the HP-49G and hp 50g also). No fancy program, but in theory it obeys a physical principle, if I haven't made any mistake (I'll explain later). 787 bytes, but it can be easily optimized for size.

Code:

%%HP: T(3)A(D)F(.);
\<< # 131d # 63d
BLANK PICT STO 66
125
  FOR c c 66 - \v/
NEG 8 + 4 * R\->B c
R\->B SWAP OVER NEG
131 + OVER NEG 63 +
4 PICK OVER 4 PICK
6 PICK 2 \->LIST
PIXON 2 \->LIST PIXON
2 \->LIST PIXON 2
\->LIST PIXON
  NEXT { # 0d # 0d
} { # 130d # 63d }
BOX { # 125d # 0d }
{ # 125d # 63d }
LINE { # 6d # 0d }
{ # 6d # 63d } LINE
7 65
  FOR c c NEG 65 +
\v/ NEG 8 + 4 * R\->B c
R\->B SWAP DUP2 NEG
63 + 2 \->LIST ROT
ROT 2 \->LIST LINE
  NEXT { # 0d # 0d
} PVIEW 2 WAIT 7 64
  FOR c c NEG 65 +
\v/ NEG 8 + 4 * 1 +
R\->B c R\->B SWAP DUP2
NEG 63 + OVER NEG
131 + DUP2 6 PICK 2
\->LIST ROT ROT 2
\->LIST LINE 2 \->LIST
ROT ROT 2 \->LIST
TLINE { # 0d # 0d }
PVIEW .5 WAIT
  NEXT { # 0d # 0d
} PVIEW
  DO
  UNTIL KEY
  END DROP
\>>

P.S.: Place the calculator in landscape position.

P.P.S.: Edited to fix code

c NEG 65 + \v/ NEG 8 + 4 * 1 +

not

c NEG 65 + \v/ NEG 8 + 4 * 1 -

in the beginning of the last loop.
Find all posts by this user
Quote this message in a reply
10-28-2014, 08:45 AM
Post: #2
RE: Surprise graphic program (HP-48G, GX)
Cool !

It works fine on 50G
Find all posts by this user
Quote this message in a reply
10-28-2014, 03:16 PM
Post: #3
RE: Surprise graphic program (HP-48G, GX)
Also seems to work on the 48SX.
Visit this user's website Find all posts by this user
Quote this message in a reply
10-28-2014, 05:07 PM (This post was last modified: 10-28-2014 06:31 PM by Gerson W. Barbosa.)
Post: #4
RE: Surprise graphic program (HP-48G, GX)
(10-28-2014 03:16 PM)Dave Britten Wrote:  Also seems to work on the 48SX.

Thanks! So the revised 48G/GX code should run also on the HP-48S/SX:

Code:

%%HP: T(3)A(D)F(.);
\<< # 131d # 63d
BLANK PICT STO 66
125
  FOR c c 66 - \v/
NEG 8 + 4 * R\->B c
R\->B SWAP OVER NEG
131 + OVER NEG 63 +
4 PICK OVER 4 PICK
6 PICK 2 \->LIST
PIXON 2 \->LIST PIXON
2 \->LIST PIXON 2
\->LIST PIXON
  NEXT { # 0d # 0d
} { # 130d # 63d }
BOX { # 125d # 0d }
{ # 125d # 63d }
LINE { # 6d # 0d }
{ # 6d # 63d } LINE
7 65
  FOR c c NEG 65 +
\v/ NEG 8 + 4 * R\->B c
R\->B SWAP DUP2 NEG
63 + 2 \->LIST ROT
ROT 2 \->LIST LINE
  NEXT { # 0d # 0d
} PVIEW 2 WAIT 7 64
  FOR c c NEG 65 +
\v/ NEG 8 + 4 * 1 +
R\->B c R\->B SWAP DUP2
NEG 63 + OVER NEG
131 + DUP2 6 PICK 2
\->LIST ROT ROT 2
\->LIST LINE 2 \->LIST
ROT ROT 2 \->LIST
TLINE { # 0d # 0d }
PVIEW .5 WAIT
  NEXT { # 0d # 0d
} PVIEW
  DO
  UNTIL KEY
  END DROP
\>>

That's the exact shape ( y = x^4 ) so that the height of water increases linearly with time. I have yet to prepare the proof.

Gerson.

P.S.: The above code works also on the HP 49G, but the following is slightly shorter:

Code:

%%HP: T(1)A(D)F(,);
« # 83h # 3Fh BLANK
PICT STO 66, 125,
  FOR c c 66, - ƒ NEG
8, + 4, * RB c RB
SWAP OVER NEG 131, +
OVER NEG 63, + 4,
PICK OVER 4, PICK 6,
PICK 2, LIST PIXON
2, LIST PIXON 2,
LIST PIXON 2, LIST
PIXON
  NEXT { # 0h # 0h }
{ # 82h # 3Fh } BOX {
# 7Dh # 0h } { # 7Dh
# 3Fh } LINE { # 6h
# 0h } { # 6h # 3Fh }
LINE 7, 65,
  FOR c c NEG 65, + ƒ
NEG 8, + 4, * RB c
RB SWAP DUP2 NEG 63,
+ 2, LIST UNROT 2,
LIST LINE
  NEXT { # 0h # 0h }
PVIEW 2, WAIT 7, 64,
  FOR c c NEG 65, + ƒ
NEG 8, + 4, * 1, +
RB c RB SWAP DUP2
NEG 63, + OVER NEG
131, + DUP2 6, PICK
2, LIST UNROT 2,
LIST LINE 2, LIST
UNROT 2, LIST TLINE
{ # 0h # 0h } PVIEW
,5 WAIT
  NEXT { # 0h # 0h }
PVIEW
  DO
  UNTIL KEY
  END DROP
»
Find all posts by this user
Quote this message in a reply
10-28-2014, 05:16 PM
Post: #5
RE: Surprise graphic program (HP-48G, GX)
(10-28-2014 08:45 AM)Gilles Wrote:  Cool !

It works fine on 50G

This looks better on the hp 50g:

Code:

%%HP: T(3)A(D)F(.);
\<< # 131d # 80d BLANK PICT STO 66. 125.
  FOR c c 66. - \v/ NEG 10. + 4. * R\->B c R\->B SWAP OVER NEG 131. + OVER NEG 79. + 4. PICK OVER 4. PICK 6. PICK 2. \->LIST PIXON 2. \->LIST PIXON 2. \->LIST PIXON 2. \->LIST PIXON
  NEXT { # 0d # 8d } { # 130d # 71d } BOX { # 125d # 8d } { # 125d # 71d } LINE { # 6d # 8d } { # 6d # 71d } LINE 7. 65.
  FOR c c NEG 65. + \v/ NEG 10. + 4. * R\->B c R\->B SWAP DUP2 NEG 79. + 2. \->LIST UNROT 2. \->LIST LINE
  NEXT { # 0d # 0d } PVIEW 2. WAIT 7. 64.
  FOR c c NEG 65. + \v/ NEG 10. + 4. * 1. + R\->B c R\->B SWAP DUP2 NEG 79. + OVER NEG 131. + DUP2 6. PICK 2. \->LIST UNROT 2. \->LIST LINE 2. \->LIST UNROT 2. \->LIST TLINE { # 0d # 0d } PVIEW .5 WAIT
  NEXT { # 0d # 0d } PVIEW
  DO
  UNTIL KEY
  END DROP
\>>

Almost three times faster on the HP 50g, but the initialization is still somewhat slow. The first two loops might be combined into one, but I haven't tried it yet. I picture hasn't been expanded to occupy the whole screen because I don't want to distort its shape ( y = x^4 ). In a physical object with that format the height of water would increase linearly with time.

Gerson.
Find all posts by this user
Quote this message in a reply
10-28-2014, 10:56 PM (This post was last modified: 10-29-2014 12:13 AM by Gilles.)
Post: #6
RE: Surprise graphic program (HP-48G, GX)
Another way to do, using complex number to avoid B->R, lists conversions and scale transformation...

On 48 change DUPDUP with DUP DUP and screen size ...

EDIT : Update for 4 XROOT instead of SQRT
Code:

\<<
 #131d #80d BLANK PICT STO 
 (-66 -10) (65 9) PDIM

 0 60 FOR x
  x DUP 4 XROOT 2.5 * R\->C DUPDUP PIXON CONJ PIXON
  NEG DUP CONJ LINE
 NEXT
  
 (-64 -8) (64 8)  BOX 
 (-61 -8) (-61 8) LINE
 ( 61 -8) ( 61 8) LINE
 
 { # 0d # 0d } PVIEW
 1 WAIT
 
 60 0 FOR x
  x DUP 4 XROOT 2.5 * R\->C DUPDUP CONJ LINE 
  NEG DUP CONJ DUP2 TLINE PIXON PIXON
 -1 STEP

 0 WAIT DROP
\>>
Find all posts by this user
Quote this message in a reply
10-28-2014, 11:04 PM (This post was last modified: 10-28-2014 11:36 PM by Gerson W. Barbosa.)
Post: #7
RE: Surprise graphic program (HP-48G, GX)
Minor optimization in size and speed.

HP-48S/SX/G/GX
checksum: # 3536d
size: 741.5

Usage:

HG48
any key to start
any key to exit


Code:

%%HP: T(3)A(D)F(.);
\<< # 131d # 63d
BLANK PICT STO 66
125
  FOR c c 66 - \v/
NEG 8 + 4 * R\->B c
R\->B SWAP DUP2 NEG
63 + 2 \->LIST PIXON
2 \->LIST PIXON
  NEXT { # 0d # 0d
} { # 130d # 63d }
BOX { # 125d # 0d }
{ # 125d # 63d }
LINE { # 6d # 0d }
{ # 6d # 63d } LINE
7 65
  FOR c c NEG 65 +
\v/ NEG 8 + 4 * R\->B c
R\->B SWAP DUP2 NEG
63 + 2 \->LIST ROT
ROT 2 \->LIST LINE
  NEXT { # 0d # 0d
} PVIEW
  DO
  UNTIL KEY
  END DROP 7 64
  FOR c c NEG 65 +
\v/ NEG 8 + 4 * 1 +
R\->B c R\->B SWAP DUP2
NEG 63 + OVER NEG
131 + DUP2 6 PICK 2
\->LIST ROT ROT 2
\->LIST LINE 2 \->LIST
ROT ROT 2 \->LIST
TLINE { # 0d # 0d }
PVIEW .5 WAIT
  NEXT { # 0d # 0d
} PVIEW
  DO
  UNTIL KEY
  END DROP
\>>


HP 50g
checksum: # 25014d
size: 758.

Usage:

HG50
any key to start
any key to exit

Code:

%%HP: T(3)A(D)F(.);
\<< # 131d # 80d BLANK PICT STO 66. 125.
  FOR c c 66. - \v/ NEG 10. + 4. * R\->B c R\->B SWAP DUP2 NEG 79. + 2. \->LIST PIXON 2. \->LIST PIXON
  NEXT { # 0d # 8d } { # 130d # 71d } BOX { # 125d # 8d } { # 125d # 71d } LINE { # 6d # 8d } { # 6d # 71d } LINE 7. 65.
  FOR c c NEG 65. + \v/ NEG 10. + 4. * R\->B c R\->B SWAP DUP2 NEG 79. + 2. \->LIST UNROT 2. \->LIST LINE
  NEXT { # 0d # 0d } PVIEW
  DO
  UNTIL KEY
  END DROP 7. 64.
  FOR c c NEG 65. + \v/ NEG 10. + 4. * 1. + R\->B c R\->B SWAP DUP2 NEG 79. + OVER NEG 131. + DUP2 6. PICK 2. \->LIST UNROT 2. \->LIST LINE 2. \->LIST UNROT 2. \->LIST TLINE { # 0d # 0d } PVIEW .5 WAIT
  NEXT { # 0d # 0d } PVIEW
  DO
  UNTIL KEY
  END DROP
\>>

Yes, if it is not clear from the listings only, this in an hourglass :-)


P.S.: LOOKS LIKE I'VE MADE A MISTAKE IN THE SHAPE OF THE HOURGLASS IN THE PROGRAM.
I said y = x^4 ( or x = y^1/4 ) so that the height of water increases linearly with time. That's correct, but in the program I used x = sqrt (y), that is, y = x^2. I think I was somewhat sleepy when I began to write the program last night... This can be fixed, anyway we get the idea.

The following picture is correct:

[Image: hourglass_zpscdd8040e.png]
Find all posts by this user
Quote this message in a reply
10-28-2014, 11:52 PM
Post: #8
RE: Surprise graphic program (HP-48G, GX)
Using 0 WAIT DROP might is easier on the batteries and is slightly smaller than DO UNTIL KEY END DROP.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
10-29-2014, 12:04 AM (This post was last modified: 10-29-2014 12:10 AM by Gerson W. Barbosa.)
Post: #9
RE: Surprise graphic program (HP-48G, GX)
(10-28-2014 11:52 PM)Han Wrote:  Using 0 WAIT DROP might is easier on the batteries and is slightly smaller than DO UNTIL KEY END DROP.

Thanks for the tip, Han, much appreciated! It appears the clock should be off when using 0 WAIT, is this correct?
For me, that has been a good exercise on using graphics in a program. That was the first time I read about the PICTURE environment in the manual.

Gerson.
Find all posts by this user
Quote this message in a reply
10-29-2014, 12:13 AM (This post was last modified: 10-29-2014 12:19 AM by Gilles.)
Post: #10
RE: Surprise graphic program (HP-48G, GX)
(10-28-2014 11:04 PM)Gerson W. Barbosa Wrote:  P.S.: LOOKS LIKE I'VE MADE A MISTAKE IN THE SHAPE OF THE HOURGLASS IN THE PROGRAM.
I said y = x^4 ( or x = y^1/4 ) so that the height of water increases linearly with time. That's correct, but in the program I used x = sqrt (y), that is, y = x^2.

I've edited my version upside.
I think using complex numbers to plot do the thing far more easy with CONJ and NEG features and PDIM scale.
Find all posts by this user
Quote this message in a reply
10-29-2014, 12:55 AM
Post: #11
RE: Surprise graphic program (HP-48G, GX)
(10-28-2014 10:56 PM)Gilles Wrote:  Another way to do, using complex number to avoid B->R, lists conversions and scale transformation...

On 48 change DUPDUP with DUP DUP and screen size ...

EDIT : Update for 4 XROOT instead of SQRT
Code:

\<<
 #131d #80d BLANK PICT STO 
 (-66 -10) (65 9) PDIM

 0 60 FOR x
  x DUP 4 XROOT 2.5 * R\->C DUPDUP PIXON CONJ PIXON
  NEG DUP CONJ LINE
 NEXT
  
 (-64 -8) (64 8)  BOX 
 (-61 -8) (-61 8) LINE
 ( 61 -8) ( 61 8) LINE
 
 { # 0d # 0d } PVIEW
 1 WAIT
 
 60 0 FOR x
  x DUP 4 XROOT 2.5 * R\->C DUPDUP CONJ LINE 
  NEG DUP CONJ DUP2 TLINE PIXON PIXON
 -1 STEP

 0 WAIT DROP
\>>

That's more like it, thanks! Smile

I have to use my other HP 50g. The one I've been using has about 32K bytes left and give "PDIM Error: Insufficient Memory".
I've disable the clock, at is appears on the screen when the lower recipient gets full.
Sqrt Sqrt is faster than 4 XROOT.

Other improvements might be arbitrary timing in minutes and successive uses of the hourglass. A sensor like those on smartphones for automatic draining might be handy Smile

Gerson.
Find all posts by this user
Quote this message in a reply
10-29-2014, 01:18 AM
Post: #12
RE: Surprise graphic program (HP-48G, GX)
(10-29-2014 12:13 AM)Gilles Wrote:  I think using complex numbers to plot do the thing far more easy with CONJ and NEG features and PDIM scale.

Great idea!
Find all posts by this user
Quote this message in a reply
10-29-2014, 03:50 AM
Post: #13
RE: Surprise graphic program (HP-48G, GX)
Don't forget that the HP50G program can go even faster if you convert integers into "reals" (such as in the FOR loop) due to overhead from internal conversion.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
10-29-2014, 01:38 PM (This post was last modified: 10-29-2014 01:39 PM by Gilles.)
Post: #14
RE: Surprise graphic program (HP-48G, GX)
Small improvment with the sand flowing ...
For 49G+/50G

Code:
 
\<<
 #131d #80d BLANK PICT STO 
 (-66 -10) (65 9) PDIM

 0. 60. FOR x
  x DUP \v/ R\->C DUPDUP PIXON CONJ PIXON
  NEG DUP CONJ 
  IF DUP RE -46 > THEN LINE ELSE PIXON PIXON END 
  IF x 2 MOD THEN x 0 R\->C (0 .1) - DUP CONJ BOX END
 NEXT
  
 (-64 -8) (64 8)  BOX 
 (-61 -8) (-61 8) LINE
 ( 61 -8) ( 61 8) LINE
 
 { # 0d # 0d } PVIEW
 
 45. 2. FOR x
  (1 0) DUP x 14 + + TLINE
  x 15 + DUP \v/ R\->C DUP CONJ LINE
  x DUP \v/ R\->C NEG DUP CONJ DUP2 TLINE PIXON PIXON
  0.2 WAIT
 -1 STEP
 
 (0 0) (15 0) DUP2 LINE TLINE
 (0 -.1) (15 -.1) DUP2 LINE TLINE

 0 WAIT DROP
\>>
Find all posts by this user
Quote this message in a reply
10-29-2014, 06:00 PM
Post: #15
RE: Surprise graphic program (HP-48G, GX)
(10-29-2014 01:38 PM)Gilles Wrote:  Small improvment with the sand flowing ...
For 49G+/50G

Code:
 
\<<
 #131d #80d BLANK PICT STO 
 (-66 -10) (65 9) PDIM

 0. 60. FOR x
  x DUP \v/ R\->C DUPDUP PIXON CONJ PIXON
  NEG DUP CONJ 
  IF DUP RE -46 > THEN LINE ELSE PIXON PIXON END 
  IF x 2 MOD THEN x 0 R\->C (0 .1) - DUP CONJ BOX END
 NEXT
  
 (-64 -8) (64 8)  BOX 
 (-61 -8) (-61 8) LINE
 ( 61 -8) ( 61 8) LINE
 
 { # 0d # 0d } PVIEW
 
 45. 2. FOR x
  (1 0) DUP x 14 + + TLINE
  x 15 + DUP \v/ R\->C DUP CONJ LINE
  x DUP \v/ R\->C NEG DUP CONJ DUP2 TLINE PIXON PIXON
  0.2 WAIT
 -1 STEP
 
 (0 0) (15 0) DUP2 LINE TLINE
 (0 -.1) (15 -.1) DUP2 LINE TLINE

 0 WAIT DROP
\>>

Very nice!

A slight modification to allow for user-selected timing:

Code:

%%HP: T(3)A(D)F(.);
\<< HMS\-> 60. * 9.4 - 44. / \-> t
  \<< # 83h # 50h BLANK PICT STO (-66.,-10.) (65.,9.) PDIM 0. 60.
    FOR x x DUP \v/ R\->C DUPDUP PIXON CONJ PIXON NEG DUP CONJ
      IF DUP RE -46. >
      THEN LINE
      ELSE PIXON PIXON
      END
      IF x 2. MOD
      THEN x 0. R\->C (0.,.1) - DUP CONJ BOX
      END
    NEXT (-64.,-8.) (64.,8.) BOX (-61.,-8.) (-61.,8.) LINE (61.,-8.) (61.,8.) LINE { # 0h # 0h } PVIEW 45. 2. 0. WAIT DROP
    FOR x (1.,0.) DUP x 14. + + TLINE x 15. + DUP \v/ R\->C DUP CONJ LINE x DUP \v/ R\->C NEG DUP CONJ DUP2 TLINE PIXON PIXON t WAIT -1.
    STEP (0.,0.) (15.,0.) DUP2 LINE TLINE (0.,-.1) (15.,-.1) DUP2 LINE TLINE 0. WAIT DROP
  \>>
\>>

Usage:

- Enter time in mm.ss format; time >= 0.093 (9.3 s).
- run program
- any key to start
- any key to exit

Now it can be used for controlling the time to boil an egg, for instance :-)

When the hourglass is half way past the selected time it appear to get "choked with sand". This happens in your previous version also. This becomes irrelevant as times get longer, however.

Gerson.
Find all posts by this user
Quote this message in a reply
10-31-2014, 01:15 AM (This post was last modified: 11-02-2014 11:50 PM by Gerson W. Barbosa.)
Post: #16
RE: Surprise graphic program (HP-48G, GX)
Here are my final versions. I've stuck with my first approach, but I'd like to thank Gilles for his compact version and improvements, Han for his suggestion and those of you who were curious enough to give it a try on other calculators.
The shape can be changed at will on both calculators. For y = x^2, just remove one of the srqt characters, or replace them with 3 SQRT for y = x^3. In this case, the time parameters (15.2 and 57.2 in the HP-48GX program) will need to be adjusted properly.

HP-48G/GX

Code:

%%HP: T(3)A(D)F(.);
\<< HMS\-> 60 * 15.2 -
57.2 / \-> t
  \<< RCLF -40 CF
# 131d # 64d BLANK
PICT STO { # 125d
# 0d } { # 125d
# 63d } LINE { # 0d
# 0d } { # 130d
# 63d } BOX 66 125
    FOR c 1 c 66 -
66 / \v/ \v/ - 32 * R\->B
c R\->B SWAP DUP2 NEG
63 + 2 \->LIST PIXON
2 \->LIST PIXON 1 126
c - 66 / \v/ \v/ - 32 *
R\->B c 60 - R\->B SWAP
DUP2 NEG 63 + 2
\->LIST ROT ROT 2
\->LIST LINE
    NEXT { # 0d
# 0d } PVIEW 0 WAIT
DROP { # 65d # 31d
} { # 125d # 32d }
BOX 7 64
    FOR c 1 66 c -
66 / \v/ \v/ - 32 * 1 +
R\->B c R\->B SWAP DUP2
NEG 63 + OVER NEG
131 + DUP2 6 PICK 2
\->LIST ROT ROT 2
\->LIST LINE 2 \->LIST
ROT ROT 2 \->LIST
TLINE { # 0d # 0d }
PVIEW t WAIT
    NEXT { # 0d
# 0d } PVIEW 0 WAIT
DROP STOF
  \>>
\>>

HP 50g

Code:

%%HP: T(3)A(D)F(.);
\<< HMS\-> 60. * 4.5 - 57.1 / \-> t
  \<< RCLF -40. CF # 131d # 80d BLANK PICT STO { # 125d # 6d } { # 125d # 73d } LINE { # 0d # 6d } { # 130d # 73d } BOX 66. 125.
    FOR c 1. c 66. - 66. / \v/ \v/ - 34. * 6. + R\->B c R\->B SWAP DUP2 NEG 79. + 2. \->LIST PIXON 2. \->LIST PIXON 1. 126. c - 66. / \v/ \v/ - 34. * 6. + R\->B c 60. - R\->B SWAP DUP2 NEG 79. + 2. \->LIST UNROT 2. \->LIST LINE
    NEXT { # 0d # 0d } PVIEW 0. WAIT DROP { # 65d # 39d } { # 125d # 40d } BOX 7. 64.
    FOR c 1. 66. c - 66. / \v/ \v/ - 34. * 7. + R\->B c R\->B SWAP DUP2 NEG 79. + OVER NEG 131. + DUP2 6. PICK 2. \->LIST UNROT 2. \->LIST LINE 2. \->LIST UNROT 2. \->LIST TLINE { # 0d # 0d } PVIEW t WAIT
    NEXT { # 0d # 0d } PVIEW 0. WAIT DROP STOF
  \>>
\>>

Usage:

- Enter time in mm.ss format; time >= 0.15 (15 s) on the HP-48GX and >= 0.045 (4.5 s) on the HP 50g
- run program
- any key to start
- any key to exit

Not a surprise anymore: Smile

[Image: Hourglass-HP-48GXampHP50g_zps8e73f45d.png]

-----------

Update:

Though the difference ( for y = x^4 ) in relation to the previous version is barely noticeable, here are versions with x and y axes in the same scale. The constant 11.5 is an approximation to 32/60^(1/4).


HP-48GX
Checksum #46537d
Size 694

Code:

%%HP: T(3)A(D)F(.);
\<< HMS\-> 60 * 13.1 -
58 / RCLF -40 CF
# 131d # 64d BLANK
PICT STO { # 125d
# 0d } { # 125d
# 63d } LINE { # 0d
# 0d } { # 130d
# 63d } BOX 66 125
  FOR x x R\->B 32 x
66 - \v/ \v/ 11.5 * -
R\->B DUP2 DUP2 NEG
63 + 2 \->LIST PIXON
2 \->LIST PIXON SWAP
NEG 131 + SWAP DUP2
NEG 63 + 2 \->LIST
ROT ROT 2 \->LIST
LINE
  NEXT { # 0d # 0d
} PVIEW 0 WAIT DROP
{ # 65d # 31d } {
# 125d # 32d } BOX
7 64
  FOR x OVER WAIT
33 65 x - \v/ \v/ 11.5
* - R\->B x R\->B SWAP
DUP2 NEG 63 + OVER
NEG 131 + DUP2 6
PICK 2 \->LIST ROT
ROT 2 \->LIST LINE 2
\->LIST ROT ROT 2
\->LIST TLINE
  NEXT 0 WAIT ROT
DROP2 STOF
\>>

HP 50g
Checksum #45216d
Size 686.5

Code:

%%HP: T(3)A(D)F(.);
\<< HMS\-> 60. * 3.8 - 58. / RCLF -40. CF # 131d # 80d BLANK PICT STO { # 125d # 8d } { # 125d # 71d } LINE { # 0d # 8d } { # 130d # 71d } BOX 66. 125.
  FOR x x R\->B 40. x 66. - \v/ \v/ 11.5 * - R\->B DUP2 DUP2 NEG 79. + 2. \->LIST PIXON 2. \->LIST PIXON SWAP NEG 131. + SWAP DUP2 NEG 79. + 2. \->LIST UNROT 2. \->LIST LINE
  NEXT { # 0d # 0d } PVIEW 0. WAIT DROP { # 65d # 39d } { # 125d # 40d } BOX 7. 64.
  FOR x OVER WAIT 41. 65. x - \v/ \v/ 11.5 * - R\->B x R\->B SWAP DUP2 NEG 79. + OVER NEG 131. + DUP2 6. PICK 2. \->LIST UNROT 2. \->LIST LINE 2. \->LIST UNROT 2. \->LIST TLINE
  NEXT 0. WAIT DROP NIP STOF
\>>

Usage same as above. Minimum timings are are about 14 and 5 seconds, respectively.
Find all posts by this user
Quote this message in a reply
11-03-2014, 12:01 AM
Post: #17
RE: Surprise graphic program (HP-48G, GX)
Here's a more classical hourglass shape on the HP 49g+ (ROM Revision #2.15, m48+ emulator on iPhone4S), usage same as above.

I can't keep the menu labels from showing, however. Is this a problem with the #2.15 ROM or am doing something wrong?

[Image: HourGlass_49g_zps39dfa3ca.png]

[Image: hg_48g_RPL_zps40eb7d93.png]
Find all posts by this user
Quote this message in a reply
11-03-2014, 07:01 PM
Post: #18
RE: Surprise graphic program (HP-48G, GX)
Hi Gerson ! This shape looks better Wink
could you post your program in text format ?
Find all posts by this user
Quote this message in a reply
11-03-2014, 11:48 PM
Post: #19
RE: Surprise graphic program (HP-48G, GX)
(11-03-2014 07:01 PM)Gilles Wrote:  Hi Gerson ! This shape looks better Wink
could you post your program in text format ?

I hope the proportions are correct. Anyway, you can vary the width by changing the 9.5 constants.
Upper recipient starting entirely full to the brim and no animated flowing sand, however Smile

Code:

%%HP: T(3)A(D)F(.);
\<< HMS\-> 60. * 4.7 - 57.8 / RCLF -40. CF # 131d # 80d BLANK PICT STO { # 6d # 11d } { # 6d # 68d } LINE { # 125d # 11d } { # 125d # 68d } LINE { # 0d # 10d } { # 130d # 69d } BOX 66. 125.
  FOR x x R\->B 40. x 66. - DUP 2.5 ^ -.00026 * SWAP 1.5 ^ .021 * + .11 + 9.5 * - R\->B DUP2 DUP2 NEG 79. + 2. \->LIST PIXON 2. \->LIST PIXON SWAP NEG 131. + SWAP DUP2 NEG 79. + 2. \->LIST UNROT 2. \->LIST LINE
  NEXT { # 0d # 0d } PVIEW 0. WAIT DROP { # 65d # 39d } { # 125d # 40d } BOX 7. 64.
  FOR x OVER WAIT 41. 65. x - DUP 2.5 ^ -.00026 * SWAP 1.5 ^ .021 * + .11 + 9.5 * - R\->B x R\->B SWAP DUP2 NEG 79. + OVER NEG 131. + DUP2 6. PICK 2. \->LIST UNROT 2. \->LIST LINE 2. \->LIST UNROT 2. \->LIST TLINE
  NEXT 0. WAIT DROP NIP STOF
\>>
Find all posts by this user
Quote this message in a reply
Post Reply 




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