
			  Magic48ges presents:


	     #####  #####  #####   ####  ###   ###	###
	       #	#    #	  #   #   #   #   #    #   #
	       #	#    #	  #   #   #   # 	   #
	       #     ####    #	   ####   #    ###	 ##
	       #	#    #	    # #   #	  #	#
	       #	#    #	   #  #   #   #   #    #
	       #    #####    #	  #   #  ###   ###     #####



		 AN EXCITING GAME FOR THE HP48 AND HP38G


			       Version 2.5


	     (c) 1998 by Detlef Mueller and Raymond Hellstern
	 Original Concept, Design and Program by Alexey Pazhitnov


CONTENTS
========


1. Introduction
    1.1   Copyright & Acknowledgements
    1.2   TETRIS
    1.3   Requirements & Installation Instructions
    1.3.1 HP48
    1.3.2 HP38G
    1.4   Starting The Game
    1.4.1 HP48
    1.4.2 HP38G

2. TETRIS' Interface
    2.1   The Main Screen
    2.2   The Key Setup Screen
    2.3   The Game Screen

3. Hints & Information
    3.1   General Notes
    3.2   2-Player Game Notes


1. Introduction
===============


1.1 Copyright & Acknowledgements
--------------------------------

All files in the TETRIS2 kit are copyright (c), 1999 by Detlef Mueller
and Raymond Hellstern -- unless otherwise noted.

The TETRIS2 kit is  distributed  in the hope that it will be fun,  but
TETRIS2 is provided 'as is',  and is subject to change without notice.

D.  Mueller and R.  Hellstern make no warranty of any kind with regard
to the software or documentation,  including, but not limited to,  the
implied  warranties of	merchantability  and fitness for a  particular
purpose.

D. Mueller  and R. Hellstern  shall not be liable for any error or for
incidental  or	consequential  damages in connection  with the supply,
performance, or use of this software and documentation.

This version of TETRIS2 is a GiftWare release.	You may use it as long
as you like without registration.

Permission to copy the whole,  unmodified  TETRIS2  package is granted
provided  that the  copies  are not  made  or  distributed  for resale
(excepting nominal copying fees).

It  _should_  be impossible to crash your calculator by using TETRIS2,
but be warned: no software is bug free! If you encounter a bug, please
report it to detlef@provi.de

Credits go to (in no particular order)

    * Hewlett-Packard for the HP48 and HP38G
    * A. Pazhitnov and V. Gerasimov for inventing TETRIS
    * Bullet-Proof Software for their HP48SX & GameBoy TETRIS versions
    * Jack Levy for '48 alpha & beta testing
    * Will Laughlin for '48 alpha & beta testing
    * Doug Cannon  for proof reading an early version of this document
    * Jean - Yves Avenard for publishing the ApLet frame the '38G port
      partly bases on
    * Jim Donnelly for "An Introduction to HP..." - it pointed me to a
      neat trick to turn on/off the menubar I didn't recognized before
      and for the kindly support on the '38G port.
    * Colin Croft for (bullet-) proof reading this document,  for '38G
      beta testing and suggestions
    * ...


1.2 TETRIS
----------

TETRIS is an  arcade-type game	developed ~1987 in the USSR by	Alexey
Pazhitnov and V. Gerasimov. The game rules are simple: blocks of seven
different shapes drop into the play area  and fall to the bottom.  You
must try to prevent  the block pile from reaching the top of the area.
While a block is falling down,	you can move it left / right  and turn
it.  If you fill a line it  disappears	and you gain points.  The game
ends when the block pile reaches the top of the playing area.

TETRIS is derived from the russian word for 'four' ( 'tetra' ) because
each of the seven block shapes are made with different arrangements of
four small squares.

TETRIS became very popular  because  the game was ported to nearly any
machine containing a CPU,some RAM, keys and a display -- even for HP's
HP48  calculator  many	versions  exist. TETRIS2  is one  of the  most
advanced TETRIS versions for the '48 series and the '38G, featuring:

    * small size (< 6-7kb), giving a very good size/performance ratio
    * high speed (completely written in sysRPL/assembler)
    * '48 and '38G type and ROM revision independency
    * very close to the original TETRIS gameplay
    * customizable control keys
    * storing of the current game in progress
    * a highscore table
    * configuration of the gameplay:
      - next block preview on/off
      - initial level
      - initial fill level
      - turbo on/off
    * three game modes:
      - normal
      - randomly prefilled area
      - end after n lines
    * all of the above in 2-Player games via serial I/O (IR or wire)


1.3 Requirements & Installation Instructions
--------------------------------------------

TETRIS2 works on _every_ HP48 (S or G, X or not,  any revision) - it's
tested on ROM revisions A, E, L, M and R by the authors; it's reported
to run also on ROM revisions D, J and K '48s.

The HP38G version should run on any '38G,  it's tested on ROM revision
A1.67 by the authors.


1.3.1 HP48
----------

To install the game on a '48,  download the library file (TETRIS2.LIB)
to your '48,  recall it to the stack and purge the variable containing
the downloaded library.  Enter the port number (0, 1, .. -- on a '48GX
port 0 or 1 is _strongly_ recommended !) where you  want  to store it,
then press STO. Power-cycle your '48. TETRIS2 will now be installed.

Note that the game maintains a variable named  'T2par'  in the current
directory to store setup and game information.	 It will be created if
it doesn't exist when  starting the game and its size is normally  ~73
bytes, when storing a game ~435 bytes.

TETRIS2 uses USERFLAGS 1 and 2. They are set to 0 upon game exit.

To get rid of the game,  execute the following commands (if TETRIS2 is
stored in a port > 0, make sure the corresponding card is set to R/W):

    HOME		@ switch to the home directory
    268 DETACH		@ release library
    :&:268 PURGE	@ search and purge it

TETRIS2 library information:

    ID	     : 268
    size     : 6509 bytes
    checksum : #7ED3h


1.3.2 HP38G
-----------

You can load the game from another '38G or via cable from a computer.I
can't say anything about the former method; you should know what to do
(the nearest person I know owning a '38G lives ~200km from here...).

To load the game via the cable, make sure that the files  HP38DIR.CUR,
HP38DIR.000,LIB1537L.000 and TETRIS20.000 are in the current directory
of the computer and use the Connectivity Kit and cable to transfer the
ApLet to the LIB view of the '38G.  Connect your '38G to the computer,
switch it on  and enter the library view by hitting  [LIB].  Press the
[RECV] softkey,  select Disk drive... and hit [ENTER].	 After a short
pause you will be able to select Tetris2 and press [ENTER] again. Once
the game is loaded, it appears as Tetris2 in the library view.

Alternatively,	if you have a cable but not the Connectivity software,
then start Kermit in server mode  with the settings  9600bd,  8N1,  no
handshake and binary mode.  Use the same methods to transfer the ApLet
to the calculator.

To get rid of the game, enter the library view, select Tetris2 and hit
the [DEL] key. Answer with yes and it'll be gone...

ATTN: There's at least one known bug in the '38G Tetris2 version:  the
ApLet frame we used does not provide a correct	[SYMB]	View handling.
After playing with Tetris2, you should deselect the ApLet in the [LIB]
View,  else pressing the [XTTheta] key in the  [HOME]  View will cause
unpredictable  results.   This may  include  loss of memory  !	If you
encounter this situation,you should immediately execute a warmstart by
pressing ON-SK3 simultanousely (SK3 is the 3rd softkey from the left).


1.4 Starting the game
---------------------

1.4.1 HP48
----------

Switch to the  TETRIS library menu  and press the menu button  labeled
'TETRIS'.


1.4.2 HP38G
-----------

Enter the LIB menu, highlight the Tetris2 entry and press ENTER.


2. TETRIS' Interface
====================


Note:	In the following descriptions,	'48 only operations are marked
	with (48), '38G only operations with (38).


2.1 The Main Screen
-------------------

When starting TETRIS, its main screen comes up:

    +----------------------------+
    |Top 5	     Game Setup  |
    | 30000+	   LEVEL:	0|
    | 10000	   FILL:	0|
    |  5000	   NEXT PIECE: ON|
    |  3000	   END AFTER: OFF|
    |  1000	   TURBO:     OFF|
    |Current score: 0		 |
    |###  ###  ###  ###  ###  ###|
    +----------------------------+
      |    |	|    |	  |    |    Main (48)	Main (38)	Setup
      |    |	|    |	  |    |    ---------	---------	-----
      |    |	|    |	  |    +--- QUIT	SETUP		MAIN
      |    |	|    |	  +-------- SETUP	KEYS		TURBO
      |    |	|    +------------- KEYS	IR/WIRE 	END
      |    |	+------------------ 2PLAY	2PLAY		NEXT
      |    +----------------------- CONT	CONT		FILL
      +---------------------------- PLAY	PLAY		LEVEL

From here you can

    press	to
    -----	--
    [PLAY]	start a game (see 2.3, 3.1)
    [CONT]	if displayed, continue a stored game (see 2.3, 3.1)
    [2PLAY]	start a 2-Player game (see 2.3, 3.1, 3.2)
    [KEYS]	enter the key setup screen (see 2.2)
    [SETUP]	enter the setup menu (see below)
    [QUIT]	(48) exit TETRIS

    [IR]	(38) set 2-Player I/O mode to wire
    [WIRE]	(38) set 2-Player I/O mode to IR

    [LEVEL]	change the initial game speed level (0-9)
    [FILL]	change the amount of randomly prefilled lines (0-15)
    [NEXT]	toggle next shape preview on/off
    [END]	change the number of lines to clear until the game
		ends (0-9999)
    [TURBO]	toggle turbo mode on/off
    [MAIN]	enter the main menu (see above)

    [ENTER]	start a game (see 2.3, 3.1)
    [ON]	(48) exit TETRIS
    [OFF]	turn the calc off. [ON] will return to the main screen


Notes:	The  highscore	table  and  the  game  setup  information  are
	displayed using the very small font.

	Highscores followed by a '+' where done in turbo mode.

	While  entering  a  number  ([END],  [FILL]  or  [LEVEL])  the
	following keys are active:

	[0]-[9] 	add digit
	[<-]		(48) remove rightmost digit
	[DEL]		(38) remove rightmost digit
	[ENTER] 	accept number and return to previous screen
	[ON]		abort  entering,  restore old value and return
			to the previous screen

	On a '48,  TETRIS will restore the LastMenu upon exit,  ie. it
	simulates pressing right-shift NXT.This is intended to be some
	sort of 'Boss'-functionality...


2.2 The Key Setup Screen
------------------------

After pressing [KEYS] from the main menu,  the keys setup screen comes
up:

    +----------------------------+
    |To reassign an	    +---+| \
    |action, press the	    |	|| |
    |menu key for the	    +---+| |
    |action, then the	    |###|| +- A small graphical representation
    |new key.		    |###|| |  of the calc  showing the current
    |			    |###|| |  key setup
    |			    +---+| /
    |###  ###  ###  ###  ###  ###|
    +----------------------------+
      |    |	|    |	  |    |
      |    |	|    |	  |    +--- EXIT
      |    |	|    |	  +-------- DR - drop
      |    |	|    +------------- TR - turn right
      |    |	+------------------ TL - turn left
      |    +----------------------- MR - move right
      +---------------------------- ML - move left

From here you can

    press	to
    -----	--
    [ML]	reassign the move left key
    [MR]	reassign the move right key
    [TL]	reassign the turn right key
    [TR]	reassign the turn left key
    [DR]	reassign the drop key
    [EXIT]	return to the main screen ( see 2.1 ).	This will also
		save the current key setup

    [ON]	return to the main screen  ( see 2.1 ).  This will not
		save any changes

    [OFF]	turn the calc off.  [ON] will return to the setup keys
		screen


Note:	The default key assignment is:

	[ML]	[left arrow]
	[MR]	[right arrow]
	[TL]	[up arrow]
	[TR]	(38) [SK5], (48) [VAR]
	[DR]	[down arrow]


2.3 The Game Screen
-------------------

When starting a game, the TETRIS screen comes up:

    +----------------------------+
 +- |# | ##  |	 Score:0	 | -- Current score
 |  |  |  ## |			 |
 |  |  |     |	 Level:0	 | -- Current level
 |  |  |     |			 |
 |  |  |     |	 Lines:0	 | -- Number of lines filled
 |  |  | #   |			 |	     or left to fill
 |  |  | ### |	 2Play:Wire	 | -- Only in 2-Player mode: IR or Wire
 |  |  +-----+			 |
 |  +----------------------------+
 |
 |     \--+--/
 |	  |
 |	  +------------------------ TETRIS game area
 +--------------------------------- Preview field

From here you can

    press	to
    -----	--
    [DR]	drop the current block
    [TR]	turn the current block right
    [TL]	turn the current block left
    [MR]	move the current block right (repeats if held down)
    [ML]	move the current block left (repeats if held down)

    [NXT]	(48) toggle block preview on/off
		     (delayed until current block is down)
    [STO]	(48) store the current game and
		     return to the main screen
    [SK6]	(38) toggle block preview on/off
		     (delayed until current block is down)
    [ENTER]	(38) store the current game and
		     return to the main screen
    [ON]	abort the current game and return to the main screen
		(score will be recognized)


Note:	If you've overloaded one of the fixed keys above,  that action
	will not be available  until you redefine that key to  another
	(free) one (see 2.2).


3. Hints & Information
======================


3.1 General Notes
-----------------

There are seven different blocks made of four little squares in TETRIS:

    #	 #   #	#
    ##	##   #	#    #	 ##
     #	#   ##	##  ###  ##  ####

How to play:	 sort the blocks to create horizontal lines of squares
without gaps,  every filled line disapears  and the  remaining squares
above are moved down.

The speed at which the	blocks fall  depends on the level;  the higher
the  level,  the  faster  the blocks  fall.  The level	will  increase
automatically during game play from time to time...

Points are scored each time a block is placed or a line is filled.

The amount of points scored is increased on

    * higher levels
    * early drops
    * filling 1, 2, 3 or 4 lines per drop
    * no preview active

Eg. filling one line on level 0 returns 40 points,  filling four lines
on level 9 returns 12000 or more points.

The game ends when one of the following happens:

    * the game area is filled to the top with blocks
    * the amount of lines defined with [END] ( > 0) are cleared
    * one of the above	happens to you or  your opponent in a 2-Player
      game

How to deal with overhangs ?

To solve this situation:

    +-------+
    |	  # |
    |	  # |
    |	 ## |
    |  #    |
    | ##    |
    | #     |
    +-------+

move the descending  block one to the left,  wait until it reaches the
bottom line and then  quickly  'shuffle'  it to the left again to fill
the overhang. Ie.:

    +-------+  +-------+
    |	    |  |       |
    |	 |  |  |       |
    |	 v  |  |       |
    |  # #  |  |  ##   |
    | ## #  |  | ###   |
    | # ##  |  | ###<- |
    +-------+  +-------+


Note that while playing a game,your HP will drain ~twice the power off
the batteries than during normal usage	(that is because it never goes
into any power saving mode where the little hourglass  is turned off).
A 2-Player game will further increase this value by ~5-10%,  so having
a set of replacement batteries with you might come very handy... :-)


3.2 2-Player Game Notes
-----------------------

TETRIS2 provides a 2-Player mode,  ie. two people owning a '48 or '38G
can play against each other (a '48 user can play against a '38G user).
To start a 2-Player game first install TETRIS2	on  both  calculators.
On a '38G,set the game into IR or WIRE mode (see above), on a '48, set
the IO modes to this values:

    IR/wire:	  IR	     (should be Wire if you have a NULL-cable)
    ASCII/binary: binary
    baud:	  9600
    parity:	  none 0
    cksum:	  1
    translate:	  3

If you are linking up the calcs using IR  (most likely),  be sure that
the I/O diodes are facing each other and that the distance between the
calcs doesn't exceed ~10cm during game play.

To start the action, press [2PLAY] from the main screens on both calcs
at about the same time.

If you clear two or more lines with one block drop,  one or more lines
are added to  the bottom  of your  opponents  game area when her / his
current block stops falling:

    you clear		your opponent will get
    --------		----------------------
    2 lines		1 line
    3 lines		2 lines
    4 lines		4 lines

The game ends when one game area is filled to the top with squares.

Different  playing skills can be  compensated  by tuning the  [LEVEL],
[FILL] and [NEXT] entries in the setup menu on each calc individually.

Detlef has  worked a lot on the 2 player mode to provide an  excellent
gameplay  --  it is worth the effort to find an opponent  and discover
its subtle rules... :-)

A word about the 'Wire' setting in TETRIS2: use it, if you have a NULL
cable (a cable to connect to HPs to each other)  or in conjuntion with
Emu48 (SP8+) ! TETRIS2 runs well on Emu48 and if you have the PC<-->HP
cable, connect your HP to the PC, install TETRIS2 on both machines and
use the 'Wire' setting to play against someone else -- even two  Emu48
sessions could be connected this way. Happy experimenting :-)


$Id: tetris2.txt 2.18 1999/02/06 17:22:41 Detlef Rel $
