.;.MODULE ZEMU,RELEASE=Y01,VERSION=17,COMMENT= .;+ .; .; Copyright (c) 2000 by Megan Gentry .; Framingham, Massachussetts .; All Rights Reserved .; Commercial use and Distribution Prohibited .; .; This software was developed for use with the Z-machine emulator by .; Johnny Billquist. In this context, rights are hereby granted by .; the author for the software to be freely copied and used in its .; entirety for any non-commercial purpose so long as the above .; copyright notice and these comments are preserved. .; .; The author has used best efforts in the research, design, development .; and testing of this software. The author makes no warranty of any .; kind, expressed or implied, with regard to this software and its .; suitability for a given application. The author shall not be liable .; in any event for incidental or consequential damages in connection .; with, or arising out of, the use or performance of this software. Use .; of this software constitutes acceptance of these terms. .; .; The author is committed to making a best effort at fixing any errors .; found in the software and welcomes any reports of problems, comments, .; or suggestions regarding the software at . .; .;- .;+ .; .; Portions Copyright (c) 2000 by Johnny Billquist .; .; Abstract: .; This command procedure is designed to build the Z-Machine .; Emulator, ZEMU, on either RT or RSX. .; .; Invocation: .; RT: IND ZEMU.CMD [option [option...]] [ [...]] .; RSX: @ZEMU [option [option...]] [ [...]] .; .; Where 'option' is one or more of the following: .; .; ALL causes all modules to be built .; .; NOALL disables the second-pass build of any missing required .; modules (disables the link phase if any required modules .; are unavailable) .; .; CONFIG executes only that portion of the command procedure which .; queries the user for configuration parameters. A .; configuration file is produced and no build is performed. .; .; NOCONFIG inhibits use of an existing configuration file .; .; EXPRESS performs an express build without asking the question .; .; FCSFSL (RSX) causes FCSFSL library to be used .; .; FCSRES (RSX) causes FCSRES library to be used .; .; ID (RSX) Link as a separate I/D task .; .; NOID (RSX) Link task without separated I/D .; .; LINK (default) requests executable to be built if possible .; .; NOLINK prevents an executable from being produced .; .; LIST (default) produces listing files .; .; NOLIST does not produce listing files .; .; MULTI (RSX) builds an image which reduces the amount of memory .; used by having only one copy of the RO psect regardless .; of the number of users using the program. .; .; Notes: .; This procedure is designed to be used by someone who simply .; wants the executable (express build), or by someone who is .; doing development/maintenance and needs to build an executable .; using a new source module without having to rebuild all the .; other modules. .; .; When 'express build' is selected (the default), all required .; object modules are built, the executable is built, and then .; all the object modules are deleted. .; .; If 'express build' is rejected, the procedure asks whether .; the user wishes to configure ZEMU. If so, various questions .; are asked about how ZEMU should be built and a configuration .; file reflecting these responses is created. .; .; The user is then asked if they wish to retain the object .; modules, whether they wish to obtain listing files (and if they .; wish a cross reference) and whether they wish a map file. If .; the appropriate devices have not been assigned on RT, the user .; will be queried about them as well. .; .; If any options or module names are specified on the command line .; which invokes the procedure, 'express build' is defaulted to .; and it is assumed that the user has made the appropriate .; assignments so that full commands with all outputs can be specified. .; .; If any modules required to build an executable are missing, they .; will be automatically built. .; .;- .;+ .; .; Edit History: .; .; (01/00) 26-Sep-2000 Megan Gentry .; Initial development .; .; (01/01) 27-Sep-2000 Megan Gentry .; Adding support RSX and the stubs for support under RSTS (and .; other PDP-11 OSes .; .; (01/02) 28-Sep-2000 Megan Gentry .; o Added code to allow user to obtain listing and/or map files .; o Added code to discard the .OBJs when done .; o Rolled in portions of ZEMURSX.CMD .; .; (01/03) 29-Sep-2000 Megan Gentry .; o Added changes relating to RSX due to review by Johnny Billquist .; Different commands for MCR vs. DCL .; o For express build on RT, defaults SRC, OBJ, etc, to DK .; .; (01/04) 02-Oct-2000 Megan Gentry .; o Added some consistency in label names .; o Added support for multiple RSX CLIs by simply saving the .; CLI at the beginning and forcing DCL (to make things .; more consistent) and then restoring the CLI at the end. .; .; (01/05) 02-Oct-2000 Megan Gentry .; o Code review revealed flaw in RSX-related assembly commands. .; .; (01/06) 03-Oct-2000 Megan Gentry .; o Changes due to testing on RSX by Johnny Billquist .; .; (01/07) 04-Oct-2000 Megan Gentry .; o More changes due to testing on RSX .; .; (01/08) 05-Oct-2000 Megan Gentry .; o Yet more changes, suggestions from Johnny Billquist .; o Added code for RT expert build to detect when a MAP or .; LST device is assigned to null and to disable those .; options to make the build faster. .; o Added NOLINK and NOALL as command line options .; .; (01/09) 12-Oct-2000 Megan Gentry .; o Adding support for creation of a conditional file based .; on responses from the user .; o Added information provided by responding with an .; at many prompts .; o Allow production of a configuration file without doing .; a build .; .; (01/10) 20-Oct-2000 Megan Gentry .; o Changed global symbols to local ones (mostly). Tried to .; standardize names .; .; (01/11) 23-Oct-2000 Megan Gentry .; o Corrected some problems with the RSX build .; o Added code to detect a pre-existing configuration file .; and to give the user the option of using it, setting .; new configuration parameters, or ignoring it. .; o Finally got multiple module expert build working .; .; (01/12) 25-Oct-2000 Megan Gentry .; o Fixed defaults for FCSFSL vs. FCSRES for express build .; .; (01/13) 26-Oct-2000 Megan Gentry .; o EXPRESS option, some documentation .; .; (01/14) 30-Oct-2000 Megan Gentry .; o Added support for new functionality in ZEMU -- scripting files. .; .; (01/15) 31-Nov-2000 Megan Gentry .; o Corrected code (again) which handles building missing modules. .; .; (01/16) 01-NOV-2000 Megan Gentry .; o Incorporated fixes from Johnny -- removed comments which .; include apostrophes since the RSX version of IND attempts .; to do a substitution. .; o Incorporated changes from Johnny -- changes to the build procedure .; for RSX so that the new scripting feature is included. .; .; (01/17) 01-Nov-2000 Megan Gentry .; o Added some RSX-specific options, FCSRES and FCSFSL so that .; an expert build on RSX can specify something other than the .; default. Also, ID vs NOID to enable (default) or disable .; linking as an ID executable. Also, MULTI to enable multi- .; user image (one copy of read-only PSECT). .; o Fixed procedure on RSX so that all errors will exit through .; a common point which restores the original CLI .; .;- .;+ .; .; To Be Done: .; o Mechanism for specifying program name .; .; o Mechanism for specifying definition file .; .; o Mechanism for specifying link-time libraries, and maybe .; invocation of command procedure which would build them .; when needed. .; .; o add code to remove options from parameter string once .; processed. .; .; o Options need to be somehow signified by '-' or '/' .; or something since smaller option names have an increased .; chance of being a substring of a module name. eg. 'OBJ' .; would be found in a string requesting the module ZOBJ .; .; or .; .; There needs to be a smarter parsing algorithm for options. .; .;- .; This is the initialization phase of the procedure .Enable Substitution,TimeOut,Global .Enable Escape .Disable Lowercase .SETF OS$IAS .SETF OS$RST .SETF OS$RSX .SETF OS$RMP .SETF OS$RT .SETF OS$VMS .IF EQ 3 .SETT OS$IAS .IF EQ 4 .SETT OS$RST .IF EQ 0 .OR .IF EQ 1 .SETT OS$RSX .IF EQ 2 .OR .IF EQ 6 .SETT OS$RSX .IF EQ 6 .SETT OS$RMP .IF EQ 7 .OR .IF EQ 10 .SETT OS$RT .IF EQ 5 .SETT OS$VMS .IFT OS$RSX .OR .IFT OS$RT .GOTO OSOKAY ; ; Unsupported operating system .EXIT .OSOKAY: .IFT OS$RT .Disable Octal,Prefix .IFT OS$RSX .Enable Decimal .; If the command line which invoked this procedure contains any .; parameters whatsoever, we assume that the user wants an expert .; build which will perform a build without any query. .SETF EXPERT .IF P1 NE "" .SETT EXPERT .; Get all parameters in one symbol .SETS PARAMS "" .TEST COMMAN .SETN STREND .TEST COMMAN " " .IF NE 0 .SETS PARAMS COMMAN[+1:'STREND'] .; Parse the parameters for recognized options .SETT OP$ALL .IFT EXPERT .SETF OP$ALL .TEST "'PARAMS'" "ALL" .IF NE 0 .SETT OP$ALL .TEST "'PARAMS'" "NOALL" .IF NE 0 .SETF OP$ALL .SETT OP$LNK .TEST "'PARAMS'" "LINK" .IF NE 0 .SETT OP$LNK .TEST "'PARAMS'" "NOLINK" .IF NE 0 .SETF OP$LNK .SETF OP$NCF .SETF OP$CFG .TEST "'PARAMS'" "NOCONFIG" .IF NE 0 .SETT OP$NCF .IFF OP$NCF .TEST "'PARAMS'" "CONFIG" .IFF OP$NCF .IF NE 0 .SETT OP$CFG .SETF EXPRES .TEST "'PARAMS'" "EXPRESS" .IF NE 0 .SETT EXPRES .IFT EXPRES .SETF EXPERT .SETF OP$FSL .TEST "'PARAMS'" "FCSFSL" .IF NE 0 .SETT OP$FSL .SETF OP$RES .TEST "'PARAMS'" "FCSRES" .IF NE 0 .SETT OP$RES .IFT OP$RES .AND .IFT OP$FSL ; .IFT OP$RES .AND .IFT OP$FSL ; Conflicting options FCSRES and FCSFSL .IFT OP$RES .AND .IFT OP$FSL .GOTO REPDON .SETF OP$NID .SETF OP$ID .TEST "'PARAMS'" "NOID" .IF NE 0 .SETT OP$NID .IFF OP$NID .TEST "'PARAMS'" "ID" .IFF OP$NID .IF NE 0 .SETT OP$ID .SETT OP$LST .TEST "'PARAMS'" "LIST" .IF NE 0 .SETT OP$LST .TEST "'PARAMS'" "NOLIST" .IF NE 0 .SETF OP$LST .SETF OP$MUL .TEST "'PARAMS'" "MULTI" .IF NE 0 .SETT OP$MUL .SETN $Error 0 .SETS STARS "****************************************************************" .; List the names of the source modules which comprise this program .SETS FI$SRC "ZEMU ZALU ZCTRL ZINTER ZIO ZMEM" .SETS FI$SRC "'FI$SRC' ZOBJ ZOPTAB ZPARSE ZPRINT ZSCREE ZPIC ZTEXT" .IFT OS$RSX .SETS FI$SRC "'FI$SRC' ZRSX" .IFT OS$RT .SETS FI$SRC "'FI$SRC' ZRT ZRTLIB" .; If we are running under RSX, then change our CLI to DCL so that we .; can use a common set of commands... we'll restore the CLI when it .; comes time to exit .IFF OS$RSX .GOTO NOCLI1 .SETS OP$CLI "''" MCR SET /CLI=TI:DCL .NOCLI1: .SETF FG$OBJ .SETF FG$LST .SETF FG$CRF .SETF FG$MAP .; For most RSX systems, default to FCSRES .SETT FG$RES .SETF FG$FSL .; For RSX-11M+, default to FCSFSL .IFT OS$RMP .SETF FG$RES .IFT OS$RMP .SETT FG$FSL .SETS CRSW "" .SETS IDSW "" .IFT FG$FSL .SETS IDSW "/ID" .SETS MUSW "" .GOSUB CHKLOG .IFT EXPERT .GOTO INOQ .IFT EXPRES .GOTO IFAST2 ; ; 'STARS' ; Build Procedure for ZEMU, The Z-Machine Emulator ; 'STARS' .Q1: ; .Ask [] EXPRES Do you wish to perform an express build of ZEMU .IFF .GOTO A1 ; ; If you select YES, this command procedure will build an executable ; copy of ZEMU appropriate for this system, using all defaults. If ; you select NO, you will be prompted for additional information ; before an executable is built. .GOTO Q1 .A1: .IFF EXPRES .GOTO IFAST1 .GOTO IFAST2 .; Here we do setup for an expert-mode build, in which the user wants .; specific modules built. .INOQ: .IFT OP$CFG .GOTO CONFIG .SETT FG$OBJ .SETT FG$LST .SETT FG$CRF .SETT FG$MAP .; Pick up any expert settings which may override defaults .IFF OP$LST .SETF FG$LST .IFF FG$LST .SETF FG$CRF .IFT OP$RES .SETT FG$RES .IFT OP$RES .SETF FG$FSL .IFT OP$FSL .SETF FG$RES .IFT OP$FSL .SETT FG$FSL .IFT OP$NID .SETS IDSW "" .IFT OP$ID .SETS IDSW "/ID" .IFT OP$MUL .SETS MUSW "/MU" .GOTO IFAST2 .IFAST1: .GOSUB CHKCND .IF FI$CND EQ "" .GOTO Q2 .Q2B: ; .ASK [] ANS Do you wish to use the existing configuration file .IFF .GOTO A2B ; ; An existing configuration file (possibly from a prior build) ; has been detected. You may select YES to use it unmodified, ; or NO if you wish to be given the option of specifying the ; configuration parameters. .GOTO Q2B .A2B: .IFT ANS .GOTO USECFG .SETT OP$NCF .Q2: ; .ASK [] ANS Do you wish to configure ZEMU .IFF .GOTO A2 ; ; If you answer YES you will be prompted for various ZEMU ; configuration parameters which will be placed in the file ; ZEMU.CND and used to build the executable. If you answer ; NO the defaults will be used. .GOTO Q2 .A2: .IFF ANS .GOTO NOCONF ; ; Help is available for these questions. Respond with ; an character (and hit ) and you will ; receive an explanation of the question and the responses. .CONFIG: .Q3: .SETS CF$GAM "" .IFF OS$RSX .GOTO A3 ; .SETS DF$GAM "LB:''" .IFT OS$RMP .SETS DF$GAM "LB:''" .ASKS [::"'DF$GAM'"] CF$GAM What is the location of the default game file directory .IFF .GOTO A3 ; ; This parameter allows one to specify a directory which will ; be the default directory which ZEMU will search for a specified ; game. .GOTO Q3 .A3: .Q4: .SETS CF$SAV "" .IFF OS$RSX .GOTO A4 .SETS DF$SAV "SY:.ZSG;0" .IFT OS$RMP .SETS DF$SAV "SYS$LOGIN:.ZSG;0" .ASKS [::"'DF$SAV'"] CF$SAV What is the default location and file type for saved games .IFF .GOTO A4 ; ; This parameter allows one to specify the default location and ; file type for saved games. .GOTO Q4 .A4: .Q4B: .SETS CF$SCP "" .IFF OS$RSX .GOTO A4B .SETS DF$SCP "SY:.LOG;0" .IFT OS$RMP .SETS DF$SCP "SYS$LOGIN:.LOG;0" .ASKS [::"'DF$SCP'"] CF$SCP What is the default location and file type for game script files (logs) .IFF .GOTO A4B ; ; This parameter allows one to specify the default location and ; file type for any script files. .GOTO Q4B .A4B: .Q5: ; .ASKN [2.:128.:128.] CF$CSZ What is the default cache size in pages .IFF .GOTO A5 ; ; This paramter selects the number of cache pages which the emulator ; will attempt to obtain from available memory. The larger the cache, ; the better the performance will be. .GOTO Q5 .A5: .Q6: ; .ASKN [512.:16384.:1024.] CF$SSZ What is the default size of the game stack .IFF .GOTO A6 ; ; Johnny - what can I say here? .GOTO Q6 .A6: .Q7: ; .ASKN [1:11.:1.] CF$IID What interpreter ID should be used .IFF .GOTO A7 ; ; This parameter establishes the value which is used by ; the ZEMU emulator to identify itself. ; ; 1 DECsystem-20 5 Atari ST 9 Apple IIc ; 2 Apple IIe 6 IBM PC 10 Apple IIgs ; 3 Macintosh 7 Commodore 128 11 Tandy Color ; 4 Amiga 8 Commodore 64 .GOTO Q7 .A7: .Q8: .SETN CF$TID 0 .IFF OS$RT .GOTO A8 ; .ASKN [0:8.:3] CF$TID What is the default terminal type .IFF .GOTO A8 ; ; This parameter sets the terminal type which will be used by ; ZEMU when the RT-11 console is SET SCOPE. The options are: ; ; 0 = Unknown ; 1 = VT52 5 = VT200 ; 2 = ANSI 6 = VT300 ; 3 = VT100 7 = VT400 ; 4 = VT102 8 = VT500 ; ; When the RT-11 console is SET NOSCOPE, type UNKNOWN will ; always be used. .GOTO Q8 .A8: .Q9: ; .ASK [] CF$EIS Do you wish to build ZEMU using EIS instructions .IFF .GOTO A9 ; ; If you answer YES the ZEMU emulator will be built using the ; EIS instructions. This can result in a performance increase, ; but results in an executable which can only be used on those ; PDP-11s which have the EIS instruction set. ; ; If you answer NO the ZEMU emulator will be built using those ; instructions which are available on all PDP-11s. This will ; result in an executable which can be used on any PDP-11, but ; one which will run more slowly. .GOTO Q9 .A9: .Q10: .SETF CF$ESO .IFT CF$EIS ; .IFT CF$EIS .ASK [] CF$ESO Do you wish to build ZEMU using an emulated SOB instruction .IFF .GOTO A10 ; ; On some PDP-11 machines, a DEC/BNE pair of instructions are ; actually faster than the EIS instruction SOB. ; ; If you answer YES the SOB will be emulated using DEC/BNE. ; If you answer NO, the true EIS SOB instruction will be used. .GOTO Q10 .A10: .Q11: ; .ASK [] CF$ZDB Do you wish to include debugging code .IFF .GOTO A11 ; ; The ZEMU emulator can be built with code which allows debugging. ; The code, although included, is not normally operative until ; selected through a command line option. ; ; If you answer YES the ZEMU emulator will be built with the ; debugging code included. This will result in a larger ; executable and a marginal affect to performance. It might ; also prevent larger games from being used. ; ; If you anwer NO the ZEMU emulator will be built without the ; debugging code included. This will result in a smaller ; executable. .GOTO Q11 .A11: .; Questions have been answered, now produce the file .OPEN #1 'L$SRC'ZEMU.CND .DATA #1 ; created at '