[comp.sys.handhelds] Tetris2 for HP-48SX

akcs.falco@hpcvbbs.UUCP (Andrey Dolgachev) (03/10/91)

Well, I almost finished my message about Tetris, and just when I got to
the part about everything should work, just as long as teh board doesn't
screw up, the board froze up on me.  So, sorry about the format, but I
did not want to rewrite the message.
  1> Well, here we go again, here's the latest version of Tetris.  First
of    
  2> all, please refer to this version as Tetris2 to resolve the problems
of   
  3> identifying Tetris.  I will also post a much slimmer Tetris w/ only
the   
  4> most basic functions, and I'll call that SmTetris.  Now, here's
what's    
  5> new for this version:    
  6>   1)  Real Pause:  Press P during the game to pause the game and the
game 
  7> pauses, and the normal stack operations can be performed.  The game 
     
  8> stays suspended until the same copy of Tetris is started again. 
Simply   
  9> press Resume to resume the saved game.
 10>   2)  Screen Dissolving:  The screen dissolves into the game, the
high    
 11> scores, and back to the stack.  DISS was written by Joe Ervin.
 12>   3)  ON key trap.  If you press ON during the game, and you have
Wickes' 
 13> IFERR library installed, then the game cleansup after itself, but
ends    
 14> immediately (well, almost).  If you don't have the library
installed, the 
 15> game just ends, leaving stuff on the stack.  Also, pressing W!

 16> pressing Q during the game quits, but goes through the high score   
     
 17> routine.
 18>   4)  Numerous minor bug fixes and minor changes.  This includes the
     
 19> wordsize bug, the delay bug, the problem with the calculator not
being    
 20> able to turn itself off during some of the displays (like the high
scores 
 21> display), the sparkling display, and probably some other stuff I
can't    
 22> remember.  Oh yeah, opne more thing, I also changed the delay
routines so 
 23> it catches the key-presses faster. 
 24> 
 25>   Thanks goes to people who found out some of the bugs, or suggested
     
 26> revisions, Joe Ervin for the dissolve routine, Bill Wickes for his
Iferr  
 27> lib, which you have to get for yourself (it was posted recently),
and of  
 28> courser, Erik Bryntse for the original Tetris with partial ML.  BTW,
all  
 29> the usual disclaimers apply about no guarantees of no data loss, or 
     
 30> hardware loss, or you failing your calculaus quiz because you spent
too   
 31> much time playing Tetris and then it erased all your formulas which
you   
 32> didn't memorize.
 33> 
 34> Instructions:  D/l the following text section, make sure ASC-> is in
the  
 35> same level or above the level of Tetris, and press SETUP to turn
into the 
 36> playable version.  Help gives instructions.  When the game shows a
screen 
 37> of info, press a key to continue.  O.K., that's it, please make     
     
 38> suggestions, and I really hope that this posting works out (I
checked the 
 39> text copy, and it worked fine for me, as long as the board doesn't
swall  
 40> anything, it should be (see) ok.

---------------cut here-------
%%HP: T(3)A(D)F(.);
DIR
  SETUP
    \<<
      IF XFIG ASC\->
DEPTH 2 ==
      THEN
"PLEASE PUT ASC\-> IN
OR ABOVE THIS DIR."
1 DISP INFLP DROP2
      ELSE TLIST 1
1 TLIST SIZE
        START GETI
DUP RCL STRIP SWAP
STO
        NEXT DROP2
'XFIG' STO TFIG
ASC\-> 'TFIG' STO
DISS ASC\-> 'DISS'
STO { TLIST STRIP
SETUP } PURGE
      END
    \>>
  STRIP
    \<< # 21679d
SYSEVAL # 15950d
SYSEVAL # 397211d
SYSEVAL # 21573d
SYSEVAL # 397211d
SYSEVAL
    \>>
  TLIST { start
RESU ABOUT HELP
HIGH DRHI Erase
TETRIS INFLP delay
HI DRSC FIN CHHS
SHNP ADDL ADDP FULL
MKSCR MSIDE RK2 P2
PACK ROTF TLIN }
  start
    \<< LCD\-> RCLF
SWAP DEPTH 'L' STO
IFERR TETRIS THEN
    END "" 3 DISP
DEPTH L - DROPN 0
SWAP DISS STOF ""
'SAV' STO
  \>>
RESU
  \<< IFERR SAV LIST\->
DROP PICT SWAP {
# 0d # 0d } SWAP
REPL { # 0d # 0d }
PVIEW CONT THEN
"Game is not paused.
Press START to start
a new game."
3 DISP DROP INFLP
  END
\>>
              ABOUT
\<< CLLCD
"    - Tetris2 by - 
   Andrey Dolgachev
     - Credits - 
Erik Bryntse for the
original HP48 version.
Joe Ervin for the 
Screen Dissolve code."
1 DISP INFLP
\>>
              HELP
\<< CLLCD
"HIGH - Show Top 5
ERASE - Erases Top 5
     DURING GAME
N - Toggle Next
O - Off       8 - Flip
P - Pause   4,6 - R,L
Q - Quit      0 - Drop"
1 DISP INFLP \>>
              HIGH
\<< LCD\-> DUP PICT
SWAP { # 0d # 0d }
SWAP REPL { # 0d
# 0d } PVIEW DRHI 0
SWAP DISS
\>>
              Erase
\<< { 0 "" 0 } DUP DUP2
DUP 5 \->LIST
'SCORES' STO \>>
              XFIG
"CCD204410034E7507137143818F8E1358BE60691117E818F328FB97601CE1B56
507146134152739E1B20F880029916912014313234E4A201428A2606EB016915
271011741431321428A63E16915271001741431321428A68C1691567AFAAF122
A95118C9AF5BF522A8520A8181D22A82C1201B56507146818F29818F29C91341
19BF2BF2241542BF616F16F1610D880BEBF4BF4BF4AF68AA60688F208F2D7601
42164808CE7C9"
              TFIG
"CCD20E310013606DD061B97507142137135818F098BA606FF014713481AF0914
234E4A208A26060E01691527100E717414381AF2914581AF291321428A26060B
01691567AFAAF1D122A95118C9D5F522A8520A81819F122A82C1201B56507146
818F29818F29C9136AF2156090A90B456E002F308200E49BF4BF4BF4AF68AE09
AF0AF2AC48108087340E68084396840E614313216915472007DD071361421648
08C3CA6"
              DISS
"D9D20D4881D8A812BF8170140D9D208813026AC130A503223030A50322301192
004000A3D36D9D2044230C2A207200094E66716C69646027425F424024416471
6933A1B21301192038000A3D36D9D2044230C2A207200094E66716C696460274
25F4240244164716933A1B2130F7815322301192004000A3D36D9D2044230C2A
207200094E66716C696460205943445023596A756933A1B21301192038000A3D
36D9D2044230C2A207200094E66716C696460205943445023596A756933A1B21
3032230AEC8111920F780032230CCD20851008F14660AF38A850B478F14660AF
2DE109143818F09818F0981AF02174E78FB97601F56507147818F29818F2981A
F08AF234FFF3094B9034FFF00D7AF0103104AF2311194B6031F0AE581AF13777
011CC6C6114C2818F220EF781AF0C81AF0B94F92819F2819F281AF0B81961AE4
80863A080857AE881AF1181AF1B8B280DE721081AF148AC298D3415081AF1AC2
135AF014B0E6011B13381AF10C213313514FBED0E650E6ABED15D001B2130B21
309C7D"
              L 2
              SAV
""
              DRHI
\<< -.8 1.9 -6 -2.5
4.5 \-> N Y X1 X2 X3
  \<< # 131d # 64d
BLANK "HIGH SCORES"
3 \->GROB (-3.2,3.1)
SWAP REPL "SCORE"
-6.3 Y DRSC "NAME"
-1.1 Y DRSC "LINES"
3.5 Y DRSC 1 5 -.2
'Y' STO+
    FOR I N 'Y'
STO+ SCORES I GET
LIST\-> DROP 4 ROLL
SWAP X3 Y DRSC SWAP
X2 Y DRSC SWAP X1 Y
DRSC
    NEXT 0 SWAP
DISS INFLP
  \>>
\>>
              TETRIS
\<< STD 64 STWS .404
'a' STO 1 CF 3 CF
12 CF 7 CF MKSCR
RAND 7 * IP 1 +
'NPC' STO 0 'PNTS'
STO 0 'LINS' STO 0
ADDL 0 ADDP
  DO delay FLST NPC
RAND 7 * IP 1 +
'NPC' STO SHNP DUP
'OB1' STO GET 1 DUP
'OB2' STO GET # 11d
1 CF
    DO
      IF 1 FC?
      THEN RK2 RK2
RK2 RK2 a WAIT
      END
      IF 3 FC?
      THEN DUP2
# 0d XFIG # 256d +
DUP2 # 0d + TFIG
        IF # 0d ==
        THEN DUP2
# 63903d XFIG
        ELSE # 256d
- # 63903d XFIG
# 0d
        END
      END
    UNTIL DUP # 0d
== 3 FS? OR
    END
    IF 3 FC?
    THEN 20 ADDP
DROP PACK MEM DROP
    END
  UNTIL FULL 3 FS?
OR
  END FIN
\>>
              PIC1
GROB 34 24
FFFFFF3000FFFFFF3000308300300010830020000083000000008300000000830000000083
00000000830000000083000000008300000000830000000083000000008300000000830000
000083EFCF3000836CC630008368462000836006000083E706000083600600008368060000
836C060000C7EF0F00
              PIC2
GROB 34 24
00008FFF3000008FFF30000083003000008100200000810000000081000000008100000000
810000000081000000008100000000810000000087000000008FFF300000000C3000000000
30E7E700003036C300003016810000303681000030E7810000308681800030C68181083066
C38FFF3037E78FFF30
              INFLP
\<< 0 WAIT DROP \>>
              delay
\<< a .004 - DUP
  IF 0 \<=
  THEN .004 'a' STO
DROP
  ELSE 'a' STO
  END
\>>
              a
.404
              HI
\<< 4 \-> I
  \<<
"CONGRATS, YOU REACHED
THE TOP FIVE"
{ "" \Ga } INPUT
ERASE LCD\-> PICT
SWAP { # 0d # 0d }
SWAP REPL { # 0d
# 0d } PVIEW PNTS
SWAP LINS 3 \->LIST
    DO
      IF I 0 ==
      THEN 0
      ELSE SCORES I
GET CHHS
      END
      IF
      THEN -1 'I'
STO+ 0
      ELSE SCORES 1
I SUB SWAP 1 \->LIST
+ SCORES I 1 + 4
SUB + 'SCORES' STO
1
      END
    UNTIL
    END
  \>>
\>>
              DRSC
\<< R\->C SWAP 2 \->GROB
REPL
\>>
              FIN
\<< SCORES
5 GET CHHS
  IF 12 FS?
  THEN SIZE \->LIST
'ST' STO
  ELSE
    IF
    THEN HI
    END DRHI
  END
\>>
              CHHS
\<< 1 GET PNTS <
\>>
              CPC
GROB 8 12 000000000000000000000000
              PGB {
GROB 8 12 F09090F0FF9999FFF09090F0
GROB 8 12 FF9999FFF09090F0F09090F0
GROB 8 12 FF9999FF0F09090F0F09090F
GROB 8 12 0F09090FFF9999FFF09090F0
GROB 8 12 F09090F0FF9999FF0F09090F
GROB 4 16 F09090F0F09090F0F09090F0F09090F0
GROB 8 8 FF9999FFFF9999FF
}
              NPC 7
              SHNP
\<<
  IF 7 FS?
  THEN PICT { # 32d
# 27d } CPC REPL
PICT { # 32d # 27d
} PGB NPC GET DUP
SIZE BLANK 'CPC'
STO REPL
  END
\>>
              LINS
0
              ADDL
\<< 'LINS' STO+ PICT {
# 100d # 8d } LINS
1 \->GROB REPL \>>
              ADDP
\<< 'PNTS' STO+ PICT {
# 5d # 8d } PNTS 1
\->GROB REPL \>>
              FLST
{ {
# 17802707620356d
# 279242096899d
# 35399189680388d
# 279242096901d } {
# 279242096645d
# 17802707620357d
# 279242097155d
# 17806986854917d }
{ # 206226604548d
# 17944425808389d
# 279242097157d
# 17802707620355d }
{ # 279241044483d
# 17802708664837d }
{ # 210504794628d
# 35399188627717d }
{ # 52926935483141d
# 279242097412d } {
# 206226600196d } }
              FULL
\<<
# 72356802986000645d
# 778d DUP2 # 0d +
TFIG ROT ROT # 5d +
TFIG + # 0d >
\>>
              MKSCR
\<< DUP ERASE PICT {
# 91d # 38d } PIC2
REPL (-6.5,3.2)
(6.5,-3.1) BOX
(-2.2,3.2)
(1.9,-2.8) BOX
(-6.5,1.8)
(6.5,1.6) BOX 1.5
1.1
  FOR I -6.5 I R\->C
6.5 I .1 - R\->C BOX
-.2
  STEP PICT { # 3d
# 38d } PIC1 REPL
PICT { # 44d # 0d }
# 40d # 60d BLANK
REPL PICT { # 95d
# 2d } "LINES :" 1
\->GROB REPL PICT {
# 2d # 2d }
"SCORE :" 1 \->GROB
REPL PICT { # 7d
# 28d } "NEXT :" 1
\->GROB REPL PICT RCL
SWAP PICT SWAP {
# 0d # 0d } SWAP
REPL { # 0d # 0d }
PVIEW 0 SWAP DISS
\>>
              MSIDE
\<< \-> CD
  \<< DUP2 # 0d XFIG
CD + DUP2 # 0d +
TFIG
    IF # 0d \=/
    THEN CD -
    END DUP2
# 63903d XFIG
  \>>
\>>
              RK2
\<<
  IF KEY
  THEN
    IF { 72 74 92
63 34 35 33 32 }
SWAP POS DUP
    THEN {
      \<< # 1d NEG
MSIDE
      \>>
      \<< # 1d MSIDE
      \>>
      \<< 1 SF
      \>> ROTF
      \<< PICT RCL
DEPTH L - 2 + \->LIST
'SAV' STO HALT
      \>>
      \<< 3 SF
      \>> OFF
      \<< 7 FC?C
        IF
        THEN 7 SF
SHNP
        END
      \>> } SWAP GET
EVAL
    ELSE DROP
    END
  END
\>>
              OB1 3
              OB2 1
              P2
\<< 100 ADDP 1 ADDL
DUP # 3840d AND SRB
4 * 3 + # 43d SWAP
2 \->LIST PICT SWAP {
# 83d # 8d } SUB
PICT { # 43d # 12d
} ROT REPL
\>>
              PACK
\<< # 3338d
  DO TLIN
    IF # 4d ==
    THEN P2
    ELSE # 256d -
    END
  UNTIL DUP # 512d
<
  END DROP
\>>
              ROTF
\<< DUP2 # 0d XFIG
FLST OB1 GET OB2 1
-
  IF DUP 0 \<=
  THEN DROP DUP
SIZE
  END DUP \-> OS2
  \<< GET SWAP DUP2
# 0d + TFIG
    IF # 0d ==
    THEN ROT DROP
OS2 'OB2' STO
    ELSE SWAP DROP
    END DUP2
# 63903d XFIG
  \>>
\>>
              TLIN
\<< DUP
# 72356802986000645d
SWAP DUP2 # 0d +
TFIG ROT ROT # 5d +
TFIG +
\>>
              SCORES
{ { 0 "" 0 } { 0 ""
0 } { 0 "" 0 } { 0
"" 0 } { 0 "" 0 } }
              PNTS
0
              PPAR
{ (-6.5,-3.1)
(6.5,3.2) X 0 (0,0)
FUNCTION Y }
            END
------That's it---

akcs.falco@hpcvbbs.UUCP (Andrey Dolgachev) (03/10/91)

I forget to mention that I will also post the binary version up on
user.programs at hpcvbbs.

   --Falco

akcs.spacecadet@hpcvbbs.UUCP (David Cho) (03/11/91)

thanks andrey...9600 baud sure is nice!

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

Andrey, 

Nice job on TETRIS2.  It definitely seems more responsive, and I like
the new "pause" functionality.

One comment:  Did you experiment with the 'tiling' mode for the 
screen dissolver?

The bit-wise dissolve takes over 4 seconds, and it may become 
"tedious" to some users after they've seen it 100 or so times.  I
have changed my copy of TETRIS2 to use the bit-wise dissolve
only at startup, and to use the tiling mode for all screen dissolves
thereafter.   The tiling mode dissolve takes less than a second, and 
gives a slightly different effect.

Nice work!   (and thanks for using DISS)

>>>Joe Ervin

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

Andrey,


I have had a request to post my (ever so slightly) modified
version of TETRIS2 which does tiling-mode screen dissolves
for all screens except the startup screen (startup screen still 
uses the bit-wise dissolve). 

Since this is your program, I would like your blessing before
I post anything.  Again, I have modified nothing but the way
TETRIS2 does the screen dissolves.

Would you mind if I post this, and is there any special name
you would like me to give the post?

>>>Joe Ervin

P.S. Are you reachable via E-mail, or is C.S.H the only way?

akcs.lavake@hpcvbbs.UUCP (Morgan R LaVake) (03/13/91)

I had the same problem when I attempted to download Tetris2 to the 48. 
And in SmTetris, it will download fine but I get an invalid string
message from ASC->.  Were the posts corrupted, or are my captures of
them?

Morgan.
c-lmr@math.utah.edu

ryee@hpuxa.ircc.ohio-state.edu (Roger A. Yee) (03/14/91)

In article <27dd1889:2389.1comp.sys.handhelds;1@hpcvbbs.UUCP> akcs.lavake@hpcvbbs.UUCP (Morgan R LaVake) writes:
>I had the same problem when I attempted to download Tetris2 to the 48. 
>And in SmTetris, it will download fine but I get an invalid string
>message from ASC->.  Were the posts corrupted, or are my captures of
>them?
>
>Morgan.
>c-lmr@math.utah.edu

I did not have any problem downloading the smtetris, but did in the
Tetris2.  I have determined it is in the large grobs-Pic1 and Pic2
I think - NOPE FOR SURE JUST CHECKED.  The problem is in the first
8-12 characters in the 3 line (looking in the text file).  I was abel
to determine this by downloading it as a string (using " " ), then when
trying to remove them the invalid syntex (?) came up.  I would really
like to see this one with all the bells and whistles, so could the
orginal poster or someone who has the working version, post these two
in ->asc format to skip/resolve this problem PLEASE!!!

Thanks,

Roger
ryee@hpuxa.ircc.ohio-state.edu

P.S.  If I get the O.K. from Jan Brittenson, I got star-1.04.4 (the
      latest) zipped on my machine so those without unix accounts
      might be able to enjoy the fruits of his/her(?) labor.  I could
      post it here in the zipped or self extracting uuencoded form.
      The file says it is ok to redistribute, but I want to be sure.

   

akcs.falco@hpcvbbs.UUCP (Andrey Dolgachev) (03/14/91)

To Joe and anybody else,
  There are two alternatives to help with the dissolving routines, I can
either post instructions on how to change the routines from bit-wise to
tiling, which would be apain, invloving stripping and unstripping, no,
that wont' work, come to think of it.  O.K., screw that.  How about this,
I'll post a little program which will let you choose the different
dissolves or even turn them off altogether.  Yeah, that's the ticket,
I'll get that out tommorow or so.
  If anybvody has any other input or bug reports, please feel free to
post.  Anybody have any ideas on anything else they'd like to see in
Tetris?
    ---Falco

akcs.falco@hpcvbbs.UUCP (Andrey Dolgachev) (03/14/91)

O.K., i'll chekc it out, but  it's kinda strange because I know that Joe
Ervin got it to work fine.  If I find anything wrong, I'll be sure to
repost the corruptions.  Thanks for bringing up the problem.
   ---Falco

akcs.falco@hpcvbbs.UUCP (Andrey Dolgachev) (03/14/91)

GAR!!!!! I think Tetris is cursed!!!  I'm checking it over and I will
post a version which d/l's fine prob. tonite, along with the screen
changes.
   --Flaco
gar! nothing works
  --Falco
thank you

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

Andrey writes:

>O.K., i'll chekc it out, but  it's kinda strange because I know that
Joe
>Ervin got it to work fine.  If I find anything wrong, I'll be sure to
>repost the corruptions.  Thanks for bringing up the problem.
>  ---Falco
>

In all fairness, I did have some trouble with the download.  We have
several usenet servers here at Digital Equipment Corp, and the first
couple I tried had slightly corrupt versions of the intial release of 
TETRIS2.  The corruption consisted of an extra decimal point in the
definition of the 'a' variable. (something like ..404 instead of .404).

I fixed that and it seems to be fine.  

Andrey, is there any reason why you don't post this in ASC format?

>>>Joe Ervin

akcs.falco@hpcvbbs.UUCP (Andrey Dolgachev) (03/15/91)

Joe,
that's still wierd, because the reported corruption was that the one of
the PIC's was screwed up (and it was for me).  The reason I didn't post
the entire thing in ASC format is because a 7k binary file would be a 14k
ASC'd ascii file, and that might be more than some people have free on
their calculators.
   ---Falco
P.S.:  Evertythning was fixed though, read the latest update to Tetris2

jcohen@lehi3b15.csee.Lehigh.EDU (Josh Cohen [890918]) (03/22/91)

I was able to downoad big tetris.  Just look in the file and remove
the cr/lfs from the GROBS, just 2 in the file.  Be sure to only
remove them from just the 2 grobs, and not the asc encodes stuff...
thats how I got it to work...
josh
jcohen@scarecrow.csee.lehigh.edu

Yaniv Shaya <s2499576%techst02.technion.ac.il@TAUNIVM.TAU.AC.IL> (03/23/91)

Where can I download the so called "New tetris" from ?
I hope it is faster than the old one which was painfully slow...
P.S.
Could someone send a list of all ftp sites and directories that have files for
the HP48SX ? (especialy mathematics and documents for programming).

     Thanks
    ~~~~~~~~

akcs.falco@hpcvbbs.UUCP (Andrey Dolgachev) (03/25/91)

Tetris2 was posted a week or so ago on c.s.h.  I haven't put it on any
ftp sites yet though.  However, I will probably end up posting it up on
c.s.h again after a while, if I don't get it up on any ftp's.  BTW
Tetris2.1 is far better than the version you probably have, Yaniv, and
far faster.
       =--Falco