This is part one of a two part games program that runs on a VAX/VMS. It's a version of the popular arcade game tetris. Hope you like it! mail any comments to:- CADP02@uk.ac.strath.vaxe $!...................... Cut on the dotted line and save ...................... $! VAX/VMS archive file created by VMS_SHAR V-5.04 04-Feb-1988 $! which was written by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au) $! To unpack, simply save and execute (@) this file. $! $! This archive was created by CADP02 $! on Friday 7-SEP-1990 16:33:46.07 $! $! ATTENTION: To keep each article below 15872 bytes, this program $! has been transmitted in 2 parts. $! You should concatenate ALL parts to ONE file and execute (@) that file. $! $! It contains the following 5 files: $! COMPILE.COM INCLUDES.C RAND.FOR README.TXT SHAPES.PAS $!============================================================================= $Set Symbol/Scope=(NoLocal,NoGlobal) $Version=F$GetSYI("VERSION") $If Version.ges."V4.4" then goto Version_OK $Write SYS$Output "Sorry, you are running VMS ",Version, - ", but this procedure requires V4.4 or higher." $Exit 44 $Version_OK:CR[0,8]=13 $Pass_or_Failed="failed!,passed." $Goto Start $Convert_File: $Read/Time_Out=0/Error=No_Error1/Prompt="creating ''File_is'" SYS$Command ddd $No_Error1:Define/User_Mode SYS$Output NL: $Edit/TPU/NoSection/NoDisplay/Command=SYS$Input/Output='File_is' - VMS_SHAR_DUMMY.DUMMY f:=Get_Info(Command_Line,"File_Name");b:=Create_Buffer("",f); o:=Get_Info(Command_Line,"Output_File");Set(Output_File,b,o); Position(Beginning_of(b));Loop x:=Erase_Character(1);Loop ExitIf x<>"V"; Move_Vertical(1);x:=Erase_Character(1);Append_Line; Move_Horizontal(-Current_Offset);EndLoop;Move_Vertical(1); ExitIf Mark(None)=End_of(b) EndLoop;Position(Beginning_of(b));Loop x:=Search("`",Forward,Exact);ExitIf x=0;Position(x);Erase_Character(1); If Current_Character='`' then Move_Horizontal(1);else Copy_Text(ASCII(INT(Erase_Character(3))));EndIf;EndLoop;Exit; $Delete VMS_SHAR_DUMMY.DUMMY;* $Checksum 'File_is $Success=F$Element(Check_Sum_is.eq.CHECKSUM$CHECKSUM,",",Pass_or_Failed)+CR $Read/Time_Out=0/Error=No_Error2/Prompt=" CHECKSUM ''Success'" SYS$Command ddd $No_Error2:Return $Start: $File_is="COMPILE.COM" $Check_Sum_is=523446877 $Copy SYS$Input VMS_SHAR_DUMMY.DUMMY X!This command procedure will compile and link the source files for the X!game Shapes, written and copyrighted by Colin Cowie, Glasgow, Scotland, X!with certain procedures written and copyrighted by Stephen Macdonald, X!Glasgow, Scotland. X! X!It also defines the symbol "shapes" to run the program. X!Edit the symbol definition of shapes to point to the location of shapes.exe X X$write sys$output "Compiling Shapes.." X$pascal shapes X$write sys$output "Compiling Includes.." X$cc includes X$write sys$output "Compiling Rand.." X$fortran rand X$write sys$output "Linking Shapes,Includes,Rand" X$link shapes,includes,rand X$write sys$output "Finished!!" X X!The following Line should be entered in your login.com, suitably modified X$shapes:=="$disk18:[cadp02.pascal.shapes]shapes" $GoSub Convert_File $File_is="INCLUDES.C" $Check_Sum_is=1613696431 $Copy SYS$Input VMS_SHAR_DUMMY.DUMMY V/***************************************************************************** X** XCopyright 1989,1990 by Colin Cowie, Glasgow, Scotland. X X All Rights Reserved X XPermission to use, copy, modify, and distribute this software and its Xdocumentation for any purpose and without fee is hereby granted, Xprovided that the above copyright notice appear in all copies and that Xboth that copyright notice and this permission notice appear in Xsupporting documentation. V****************************************************************************** X*/ X X#include X#include X#include X#include X Xtypedef struct X{ X`009unsigned short`009length ; X`009char`009`009dtype ; X`009char`009`009class ; X`009char`009`009*pntr ; X}DESCR ; X X#define stdescr(name,string) name.length = strlen(string);\ X name.dtype = DSC$K_DTYPE_T; name.class = DSC$K_CLASS_S;\ X name.pntr = string ; X X Xvoid makechan(chan) Xint *chan; X{ X DESCR term; X int status; X stdescr(term,"TT"); X status = sys$assign (&term,chan,0,0); X if (status != 1) lib$STOP(status); X} X Xvoid readkey(key,chan) Xint *chan; Xint *key; X X{ X char inkey; X int status; X int func; X inkey = (char) 0; X func = IO$_READVBLK | IO$M_NOECHO | IO$M_TIMED; X status = sys$qiow(0,*chan,func,0,0,0,&inkey,1,0,0,0,0); X if (status != 1) lib$STOP(status); X *key = (int) inkey; X} X Xvoid waitkey(key,chan) Xint *chan; Xint *key; X X{ X char inkey; X int status; X int func; X inkey = (char) 0; X func = IO$_READVBLK | IO$M_NOECHO | IO$M_PURGE; X status=sys$qiow(0,*chan,func,0,0,0,&inkey,1,0,0,0,0); X if (status != 1) lib$STOP(status); X *key = (int) inkey; X} X Xvoid spawn() X{ X DESCR userid; X stdescr(userid,"Shapes_Refugee"); X LIB$SPAWN(0,0,0,0,&userid,0,0,0,0,0,0,0); X} X Xparam(word) Xchar word[5]; X{ X DESCR inp; X int length; X stdescr(inp," "); X LIB$GET_FOREIGN(&inp,0,&length,0); X strcpy(word,inp.pntr); X} X Xvoid usernum(userid) Xchar userid[8]; X{ X DESCR u_name; X int status; X stdescr(u_name," "); X lib$getjpi(&(JPI$_USERNAME),0,0,0,&u_name,0); X strcpy(userid,u_name.pntr); X} X Xvoid waitx(tim) Xfloat *tim; X{ X lib$wait(tim); X} $GoSub Convert_File $File_is="RAND.FOR" $Check_Sum_is=325473741 $Copy SYS$Input VMS_SHAR_DUMMY.DUMMY XC--------------------------------------------------------------------- XC RND Function - Designed, Written and Programmed by Stephen Macdonald XC Code is copyright 1988 Stephen Macdonald CHBS08 Software Consultants XC--------------------------------------------------------------------- X`009SUBROUTINE Randomise X`009INTEGER seed X`009COMMON /seed/seed X`009CHARACTER date*30 X`009CALL LIB$DATE_TIME(%DESCR(date)) X`009seed=(10000*(ICHAR(date(16:16))-ICHAR('0')) X + +1000*(ICHAR(date(17:17))-ICHAR('0')) X + + 100*(ICHAR(date(19:19))-ICHAR('0')) X + + 10*(ICHAR(date(20:20))-ICHAR('0')) X + + (ICHAR(date(22:22))-ICHAR('0'))) X`009END X X X`009INTEGER FUNCTION Random(min,max) X`009INTEGER min,max,seed X`009REAL rnd,realseed X`009COMMON /seed/seed X`009seed=(((seed+1)*75)-1).AND.65535 X`009realseed=seed X`009rnd=(realseed/65536)*(max-min)+min X`009random=rnd X`009END XC--------------------------------------------------------------------- XC RND Function - Designed, Written and Programmed by Stephen Macdonald XC Code is copyright 1988 Stephen Macdonald CHBS08 Software Consultants XC--------------------------------------------------------------------- $GoSub Convert_File $File_is="README.TXT" $Check_Sum_is=307909798 $Copy SYS$Input VMS_SHAR_DUMMY.DUMMY VThe game Shapes is based on the arcade game tetris, and follows roughly the sa Xme Xrules, Full instructions are given in the game itself. X VThe game requires a VT100 compatible terminal, and a VAX running VMS version 4 X Xor later (at any rate, 4 was the earliest version it was compiled under). X XThe source code consists of:- X X Shapes.pas - The main source code for the game X X Includes.c - Certain system calls, which were easier to write in 'C' X X Rand.for - Random number generator, written by a friend, Stephen X Macdonald, and borrowed by me, cos I couldnt be bothered X X XSetting up the game:- X XThe game shapes uses 2 data files, one for the high score table, and one for Xany saved games which might exist. The destinations of these files should be Xchanged in the source code "Shapes.pas" to point to wherever you want the Xfiles. X XThe actual lines to change are: X X Htablefile='disk18:[cadp02.pascal.shapes]Htable.dat'; X Savefile='disk18:[cadp02.pascal.shapes]save.dat'; X X XTo compile this code, execute the command procedure "compile.com" which is Xsupplied with this archive (e.g @compile ) X XAfter compiling the code you need to create 2 empty data files, one for Xthe saved games, and one for the high score table. X XThis is done from within the game itself, by entering the "Cheat" mode. XTo do this, run the game, and when the menu comes up, type in the string X"cadp8". This activates the cheat mode. X XYou are then asked for a level number. This would be what level you would Xlike to start at, if you were going to play the game. At the moment we Xare not interested in that, so type 1 and press return. X XYou are now prompted if you would like to reset the saved games file. XPress y and return. X XDo the same for the highscore table file. X XBoth files should be on world read and write access if other people are to Xbe able to play the game. X X XThe game is now ready to play. X X XNotes on the cheat mode:- X XBy entering the cheat mode as above, you can reset either , both or none of Xthe data files for the game, and choose which level to start on. Also, Vfrom within the game you can choose which shape you would like next by pressin Xg Xthe keys 1 to 7 to choose. The appropriate shape will appear in the next shape Xposition. X X XThats it!! Enjoy!! X X XYou are free to modify the code in any way whatsoever. XThere are probably major improvements that can be made in the game as it is, Xso if you make any, or have any comments, mail them to me at:- X X "CADP02@uk.ac.strath.vaxe" X $GoSub Convert_File $Goto Part4 /* ---------- */