[comp.sys.handhelds] New HP48SX Screen Dissolver

ervin@pinbot.enet.dec.com (Joseph Ervin) (03/05/91)

Hello all,

Sorry for reposting this program so soon, but I found a potential bug and I
wanted to kill it before it bit anyone.  While I was at it, I shortened the
program by around 50 bytes, and improved the speed of the bit-wise dissolve
from 5 seconds down to around 4.2 seconds.  

Enjoy!

>>>Joe
**************************************************************
The following is a new version of my screen dissolver.  This version (0.2) is
slightly faster than the original version posted recently, and is roughly 50
bytes smaller.  The ASC encoded program appears at the bottom of this message. 
A future release may allow dissolving into the menu area when viewing the
stack, if people think that would be useful (let's hear some feedback :-).

The program takes two arguments:

2: real number (zero or one)
1: GROB (131x64)

The program will do different things with the GROB depending on whether a 1 or
a 0 is in level 2.  If level 2 contains a 0, then the program will do a
bit-wise dissolve of the GROB on level 1 into PICT.  The idea here is that you
would use DISS in a program  after previously displaying some graphic image via 
PVIEW.  When you execute DISS, the new graphic on level 1 will replace the
graphic currently on the display 1 pixel at a time, in a random fashion.  The
program currently requires both the GROB on level 1 and PICT to be 131x64.  Any
other dimensions will generate an error message.  

If a 1 is on level 2 when DISS is executed, then instead of doing a bit-wise
dissolve, it will do what I call "tiling".  In this mode of operation, the
program will move random _nibbles_ from the level 1 GROB into PICT, rather than
doing one bit at a time.  The effect is slightly different, and it runs around
5 times as fast as the bit-wise dissolve (4.2 seconds for a bit-wise dissolve,
and around .9 seconds for tiling).  I think both modes look pretty cool (of
course). :-)

Well, below is the code in ASC format.  It is written in a combination of
system RPL and machine language (like Bill Wickes ASC routines themselves). 
When you ASC-> the code, you'll have a directory object in level 1.  Just store
this using any name you like.  Then you'll probably want to go down into the
directory you just created and copy the DISS program up into the home
directory, so you can use it from any directory.  

I thank Jan Brittenson for his assistance during this endeavor.  I could not 
have finished this project without his wonderful STAR assembler and his 
expert advice on writing machine language and system RPL code.  Also to be
credited are Alonzo Gariepy, who did much of the pioneering work on the saturn
processor, and Derek Nickel, who has provided a wealth of information regarding
system RPL programming on the 48SX.

I will be watching the conference dilligently for feedback, and ideas for
improvement. I found it a simple matter to include this function into TETRIS so
that the startup screen dissolves into view, producing a nice effect.

Enjoy!

>>>Joe Ervin

*************************CUT HERE***************************************
%%HP: T(3)A(D)F(.);
"D9D20D4881D8A812BF8170140D9D208813026AC130A503223030A50322301192
004000A3D36D9D2044230C2A207200094E66716C69646027425F424024416471
6933A1B21301192038000A3D36D9D2044230C2A207200094E66716C696460274
25F4240244164716933A1B2130F7815322301192004000A3D36D9D2044230C2A
207200094E66716C696460205943445023596A756933A1B21301192038000A3D
36D9D2044230C2A207200094E66716C696460205943445023596A756933A1B21
3032230AEC8111920F780032230CCD20851008F14660AF38A850B478F14660AF
2DE109143818F09818F0981AF02174E78FB97601F56507147818F29818F2981A
F08AF234FFF3094B9034FFF00D7AF0103104AF2311194B6031F0AE581AF13777
011CC6C6114C2818F220EF781AF0C81AF0B94F92819F2819F281AF0B81961AE4
80863A080857AE881AF1181AF1B8B280DE721081AF148AC298D3415081AF1AC2
135AF014B0E6011B13381AF10C213313514FBED0E650E6ABED15D001B2130B21
309C7D"

ervin@pinbot.enet.dec.com (Joseph Ervin) (03/05/91)

In article <20721@shlump.nac.dec.com>, ervin@pinbot.enet.dec.com (Joseph Ervin)
writes...

>When you ASC-> the code, you'll have a directory object in level 1.  Just store
>this using any name you like.  Then you'll probably want to go down into the
>directory you just created and copy the DISS program up into the home
>directory, so you can use it from any directory.  
> 

Oops.  I didn't post it as a directory this time, so doing ASC-> will leave the
program itself in level 1.  Just store it as DISS.  

>>>Joe

BRANSOB@CLEMSON.CLEMSON.EDU (Branson Blair) (03/06/91)

  Could you please give a short program using it?
  I tried forexample < (a grob) PICT STO {} PVIEW 1 (a grob) DISS>
  it replaced the grob in PICT but with no visual effect
  }:)???? I tried a bunch of other ways too but just the same
  result.  I even tested the speeds and they were different by about
  5 times , ......  I think its a neat thing ...
  I think a simmple program example would clear up my confusion.
                                           Thanks from,
                                              Branson

BRANSOB@CLEMSON.CLEMSON.EDU (Branson Blair) (03/06/91)

  Could you please give a short program using it?
  I tried forexample < (a grob) PICT STO {} PVIEW 1 (a grob) DISS>
  it replaced the grob in PICT but with no visual effect
  }:)???? I tried a bunch of other ways too but just the same
  result.  I even tested the speeds and they were different by about
  5 times , ......  I think its a neat thing ...
  I think a simmple program example would clear up my confusion.
                                           Thanks from,
                                              Branso

ervin@pinbot.enet.dec.com (Joseph James Ervin) (03/07/91)

Branson Blair asks:

>  Could you please give a short program using it?
>  I tried forexample < (a grob) PICT STO {} PVIEW 1 (a grob) DISS>
>  it replaced the grob in PICT but with no visual effect
>  }:)???? I tried a bunch of other ways too but just the same
>  result.  I even tested the speeds and they were different by about
>  5 times , ......  I think its a neat thing ...
>  I think a simmple program example would clear up my confusion.
>                                           Thanks from,
>                                              Branson


The problem that you're having is one that stumped me for a few minutes,
until I determined that the problem was not in DISS, but rather in how I
was using the PVIEW function.  (Read on...)

In your program, you are using an empty list as the argument for PVIEW. 
This is your problem.  Instead of an empty list, use {#0d #0d}.
The empty list tells PVIEW to go into GRAPH mode interactively.  What is
happening is that the DISS function isn't even executing until you exit
GRAPH mode, so at the time that DISS is doing its magic, you are no
longer displaying PICT.  You should probably also put in a "7 FREEZE" at
the end of your program so the final display will stay on the screen. 
Otherwise it will vanish as soon as DISS finishes.

So to summarize, change your program to this:

<< (a grob) PICT STO {#0d #0d} PVIEW 1 (a grob) DISS 7 FREEZE >>

That should give you the effect you're looking for.  Keep in mind that
DISS currently requires GROB and PICT sizes of 131x64, which is the
default size.

>>>Joe  Ervin

P.S. What ROM revision do you have?  I'm curious to make sure that DISS
works properly with all the revisions out there.