[comp.sys.handhelds] Tetris on HP28S

jurjen@cwi.nl (Jurjen NE Bos) (08/20/90)

(You thought that only the HP48 had TETRIS?)

		TETRIS for the HP28S, Version 2BB.

-------------------------------------------------------------------------------
This is a translation of an article, published by STORC. STORC (Stichting Ter
Ondersteuning van RPL Calculators) is the Dutch support-group for the HP28S,
HP48SX and HP28C. STORC publishes a (dutch) magazine, called "STORC
Nieuwsbrief", 10 times a year.

Our address:	STORC p.a. Christ van Willegen
		Dordognelaan 45
		5627 HB  Eindhoven
		The Netherlands
-------------------------------------------------------------------------------

	An adapted version of Tetris, only for the HP28S, Version 2BB.
		Written by	Dirk De Bruycker
				Kattebulkdreef 8
				9880 Aalter
				Belgium


Make sure to type the SYSEVAL addresses correct! (Use CHK for checksums)
First, type all programs in the same subdirectory, then, type the following:

............................................................

"" 1 100 START " " + NEXT 'BLANK' STO
"  " 'S2' STO

[ (1,0) (0,-1) (-1,0) (0,1) ] 'AR' STO

<< CLLCD 8 32 FOR I 54 I 55 I 76 I 77 I\
pix pix pix pix NEXT LCD-> 'IBE' STO >> EVAL

(4,2) 'T' STO
-1 'MAXIM' STO

<< 1 7 FOR NR 1 4 FOR RI CLLCD BL NR GET
AR RI GET 2 * * ARRY-> DROP 1 4 START T +
C->R p4z NEXT # 1B362h SYSEVAL 3 12 SUB
NEXT NEXT 28 ->LIST DUP 20 GET 18 SWAP PUT
'STAND' STO >> EVAL

'T' PURGE

{ TETRIS } ORDER

............................................................

Now, you are ready to go. Just type TETRIS.

Manual:

It does not exactly behave like a Tetris on a computer:

On the display, you will see a horizontal line. This is the maximum height.
On this line, the new figures will come.

You kan use the key [7] to go left, [9] to go right, and [8] to turn.

Next to the field is a scroll-bar. The higher your score, the shorter this
scroll-bar will get. When the bar reaches the top, the figure will drop.

You get points, just like the "real" Tetris, by having the dropped figures
fill a horizontal row.

When the dropped figures reach the horizontal line, the game is over. Press
key [.] to see you score.

	Loads of fun!

One final remark: The program displays its messages in dutch :-)
Your first lesson in dutch:

einde = end
pauze = pause
plaats = place
proficiat = congratulations
ptn. = pnts.
punten = points
u behaalde = you reached

............................................................

'TETRIS' [9D12]
<< IBE ->LCD ini.ar
  DO plaats BLANK
->LCD z.hoogte elim
  UNTIL 'RAA' 12 GET
  END "Einde..." 1
DISP
  DO
  UNTIL KEY
    << "." SAME
    >>
    << 0
    >> IFTE
  END CLLCD
"   U behaalde"
"   " PUNT ->STR
" punten." + + 4
DISP 2 MAXIM
PUNT <
  << PUNT 'MAXIM' STO
"Proficiat. nr 1.."
1 DISP
  >> IFT
>>

'clln' [E1A2]
<< 8 32 TIME -
  FOR W 40 W 41 W
# C1DDh SYSEVAL
# 1ADFEh SYSEVAL
# C1DDh SYSEVAL
# 1ADFEh SYSEVAL
  NEXT 32 TIME - 31
  FOR W 40 W 41 W
# C1DDh SYSEVAL
# 1ADF2h SYSEVAL
# C1DDh SYSEVAL
# 1ADF2h SYSEVAL
  NEXT
>>

'z.hoogte' [E6B7]
<< { 4 } X 54 - 2 /
DUP 'XN' STO 0 R->C
CON BL NR 1 + GET AR
RI GET * CONJ DUP
'NAR' STO + ARRY->
DROP 1 4
  START C->R KHO ROT
GET SWAP - 1 + 4
ROLL
  NEXT MAX MAX MAX
DUP 2 * 30 SWAP -
PT2S XN SWAP R->C { 4
} SWAP CON NAR +
ARRY-> DROP 1 4
  START -> PT
    << 'RAA' PT IM
RAA OVER GET 1 + PUT
KHO PT RE GET PT IM
<
      << 'KHO' PT C->R
PUT
      >> IFT 'MATR'
PT C->R SWAP 1 - 14 *
+ 1 PUT
    >>
  NEXT
>>

'plaats' [2EF4]
<< 1 'RI' STO RAND 7
* FLOOR 'NR' STO 32
'K' STO 64 'X' STO
ZET clln
  DO KEY
    << DUP "7" SAME
      << links
      >> IFT DUP "9"
SAME
      << rechts
      >> IFT DUP "8"
SAME
      << draai
      >> IFT "S" SAME
      << # 18E58h
SYSEVAL
      >> IFT
    >>
    << -1 'K' STO+ 40
K 41 K pix pix
    >> IFTE
  UNTIL K 31 TIME -
==
  END
>>

'draai' [A712]
<< (54,76) EXT 4 NR *
RI 4 MOD 1 + DUP
'NRI' STO + GET -
DUP RE X < SWAP IM X
> AND
  << NRI 'RI' STO ZET
  >> IFT
>>

'PT2S' [AE3A]
<< X SWAP R->C -> T
  << BL NR 1 + GET AR
RI GET 2 * * ARRY->
DROP 1 4
    START T + C->R
p4z
    NEXT
  >>
>>

'elim' [EE1B]
<<
  WHILE RAA RNRM 10
SAME
  REPEAT -1 'TIME'
STO+ TIME 5 <
    << 10 'TIME' STO
    >> IFT 110 KHO
CNRM - 'PUNT' STO+
"Pauze.." PUNT ->STR
+ " ptn..." + 1 DISP
RAA ARRY-> LIST-> DROP
->LIST 10 POS -> B
     << B 12
       FOR W 'RAA' W
RAA W 1 + GET PUT
      NEXT 1 10
      FOR W B KHO W
GET
        FOR R MATR W
1 - 14 * R + GET DUP
MATR W 1 - 14 * R +
1 + GET -
          << W 2 * 54
+ SWAP 30 R 2 * -
SWAP
            << p4w 0
            >>
            << p4z 1
            >> IFTE
'MATR' W 1 - 14 * R
+ ROT PUT
          >>
          << DROP
          >> IFTE
        NEXT
        WHILE KHO W
GET
          << MATR W 1
- 14 * KHO W GET +
GET NOT
          >>
          << 0
          >> IFTE
        REPEAT 'KHO'
W KHO W GET 1 - PUT
        END
      NEXT
    >>
  END
>>

'pix' [4A5]
<< # C1DDh SYSEVAL
# 1ADFEh SYSEVAL
>>

'BL' [C816]
{
[ (-1,0) (0,0) (1,0)
(1,1) ]
[ (-1,0) (0,0) (0,1)
(1,1) ]
[ (1,0) (0,0) (0,1)
(-1,1) ]
[ (1,0) (0,0) (0,1)
(-1,0) ]
[ (-1,0) (0,0) (1,0)
(2,0) ]
[ (0,0) (1,0) (0,1)
(1,1) ]
[ (-1,1) (-1,0) (0,0)
(1,0) ]
}

'EXT' [6B8A]
{ (-2,2) (0,2)
(-2,2) (-2,0) (-2,2)
(0,2) (-2,2) (-2,0)
(-2,2) (0,2) (-2,2)
(-2,0) (-2,2) (0,2)
(-2,2) (-2,0) (-2,4)
(0,0) (-4,2) (0,0)
(0,2) (0,2) (-2,0)
(-2,0) (-2,2) (0,2)
(-2,2) (-2,0) }

'links' [3D3D]
<< 56 EXT NR 4 * RI +
GET RE - X <
  << # 1B362h SYSEVAL
-2 'X' STO+ 5 137
SUB ->LCD
  >> IFT
>>

'rechts' [BDDE]
<< 74 EXT NR 4 * RI +
GET IM - X >
  << S2 # 1B362h
SYSEVAL # 25174h
SYSEVAL 2 'X' STO+ +
->LCD
  >> IFT
>>

'ZET' [251C]
<< BLANK 5 X SUB
STAND NR 4 * RI +
GET + BLANK ->LCD
->LCD
>>

'ini.ar' [CF63]
<< 24 'TIME' STO 0
'PUNT' STO { 14 } 0
CON 'RAA' STO { 10 }
0 CON 'KHO' STO {
140 } 0 CON 'MATR'
STO
>>

'p4z' [75C6]
<< OVER OVER 1 + OVER
1 + OVER OVER OVER 1
- 1 4
  START # C1DDh
SYSEVAL # 1ADFEh
SYSEVAL
  NEXT
>>

'p4w' [767E]
<< OVER OVER 1 + OVER
1 + OVER OVER OVER 1
- 1 4
  START # C1DDh
SYSEVAL # 1ADF2h
SYSEVAL
  NEXT
>>

--
|                 | "Never imagine yourself not to be otherwise than what |
| Jurjen N.E. Bos | it might appear to others that what you were or might |
|                 | have been was not otherwise than what you had been    |
|  jurjen@cwi.nl  | would have appeared to them to be otherwise."         |