Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!hp-pcd!hpcvra.cv.hp.com!rnews!hpcvbbs!akcs.falco From: akcs.falco@hpcvbbs.UUCP (Andrey Dolgachev) Newsgroups: comp.sys.handhelds Subject: Tetris2 for HP-48SX Keywords: tetris Message-ID: <27d9c3b4:2369comp.sys.handhelds@hpcvbbs.UUCP> Date: 10 Mar 91 05:40:12 GMT Lines: 529 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---