; MKBCS 10/26/07 ; ; This program automates the building of a program using ; the sio asssember and compilers and BCS linker. ; Totally Sim Specific - outputs a SimH hp2100 script to ; greatly speed up the cycle time after making a change. ; Up to 5 segments (# ENDs) can be specified for each source file. ; No error checking, tries to continue to next step right or wrong, ; if it locks up halt, fix source and try again. ; ; The output script includes set dev's set to whatever HP-IPL/OS ; is set to when this is run, if not default HP-IPL/OS slots may ; have to edit output script to disable etc if conflict. HP-IPL/OS ; is not required to run the output script, just the HP2100 sim. ; ; Files must exist in a directory named "bin" under current dir: ; sio.abs - configured 16KW SIO driver (slots must be patched) ; extasmb.abs - assembler ; algol.abs - algol compiler ; fortran1.abs - fortran compiler pass 1 ; fortran2.abs - fortran compiler pass 2 ; bcs31k.abs - configured 31KW BCS linker/loader ; bcslib.rel - standard BCS library ; ; Words at the end permit changing the extensions, bin dir and ; sio/bcs abs filenames. ; OCTAL ;all source defined in octal ; ; HLT - halts with 7 ; load code detects and deletes if dup ; "HLT" $DEFADR ;push non-zero if exists ; CREATE HLT HLT 7 END ; DEFINE TEMP ;if dup detected prompt to delete IFZ ;if no dup "TEMP" $DEFADR 4 SUB #0 PUT ;delete self ELSE ;dup detected "Forgetting dup HLT" $PRINT CRLF "HLT" $DEFADR 4 SUB #0 PUT ;delete new dup HLT ENDIF END TEMP ;do it, will delete self ; ; HOOK words for bin dir and extensions ; Modify the $ASM $FTN $ALG and $BIN words at the ; end to change, for bin dir specify "." for current ; defaults to .asm .ftn .alg and bin ; DEFINE _ASM "$ASM" $DEFADR DUP IFZ DROP ".asm" ELSE EXECUTE ENDIF END DEFINE _FTN "$FTN" $DEFADR DUP IFZ DROP ".ftn" ELSE EXECUTE ENDIF END DEFINE _ALG "$ALG" $DEFADR DUP IFZ DROP ".alg" ELSE EXECUTE ENDIF END DEFINE _BIN "$BIN" $DEFADR DUP IFZ DROP "bin" ELSE EXECUTE ENDIF END DEFINE _SIO "$SIO" $DEFADR DUP IFZ DROP "sio.abs" ELSE EXECUTE ENDIF END DEFINE _BCS "$BCS" $DEFADR DUP IFZ DROP "bcs31k.abs" ELSE EXECUTE ENDIF END ; ; MKBCS - make sim script for compiling/linking ; VARIABLE NumFiles DEFINE MKBCS "Make BCS Build Script" $PRINT CRLF "Enter basename of each source file (no extension)" $PRINT CRLF "For each file press 1 2 or 3 for " $PRINT _ASM $PRINT 40 PCHR _FTN $PRINT " or " $PRINT _ALG $PRINT CRLF "(must have those extensions) then enter the number of" $PRINT CRLF "segments (ENDs) in the source file (just enter for one)" $PRINT CRLF "Press Enter at filename prompt when all sources named," $PRINT CRLF "will halt to attach ptp to output script, after continuing" $PRINT CRLF "will prompt for ABS output filename then halt to detach." $PRINT CRLF NumFiles #0 PUT ; start with zero files DO "Filename: " $PRINT $IN $LEN IFZ ;if empty $DROP #1 ;terminate entry ELSE "1)Assembly 2)Fortran 3)Algol: " $PRINT CHRIN CRLF CASE = 61 #0 S>Z #1 = 62 #1 S>Z #1 = 63 2 S>Z #1 DEFAULT #0 ENDCASE IFZ "Try again" $PRINT CRLF $DROP #0 ELSE "# Segments: " $PRINT $IN 40 $APPEND $VAL DUP IFZ DROP #1 ENDIF ;if enter assume 1 S>Y ;save #segs on Y dir NumFiles DUP GET INC PUT ;increment NumFiles #0 ;keep looping ENDIF ENDIF UNTIL ;just enter entered ; NumFiles contains number of files ; X stack contains base file name ; Y stack contains #segments for each file ; Z stack contains type of file 0=asm 1=ftn 2=alg NumFiles GET IFZ "Nothing to do." $PRINT ELSE ; make the script "At the sim prompt enter: attach ptp scriptname" $PRINT CRLF "Then enter c to continue" $PRINT CRLF HLT "; created by MKBCS" MS$OUT MSCRLF ; write out HP-IPL/OS slot assignments to make the script stand-alone "set clk dev=" MS$OUT 270 GET DUP IFZ DROP 10 ENDIF $STR MS$OUT MSCRLF "set tty dev=" MS$OUT 355 GET $STR MS$OUT MSCRLF "set ptr dev=" MS$OUT 357 GET $STR MS$OUT MSCRLF "set ptp dev=" MS$OUT 356 GET $STR MS$OUT MSCRLF "d s 0" MS$OUT MSCRLF ; double up X stack #1 NumFiles GET +DO $DUP X>>Y X>>Z +LOOP #1 NumFiles GET +DO Y>>X +LOOP #1 NumFiles GET +DO Z>>X +LOOP ; loop thru source files #1 NumFiles GET +DO "d 2-76777 0" MS$OUT MSCRLF "load " MS$OUT _BIN MS$OUT "/" MS$OUT _SIO MS$OUT MSCRLF Z>S ;get type CASE = 0 ;assembly "load " MS$OUT _BIN MS$OUT "/extasmb.abs" MS$OUT MSCRLF "attach ptr " MS$OUT $DUP MS$OUT _ASM MS$OUT MSCRLF "attach ptp " MS$OUT $DUP MS$OUT ".rel" MS$OUT MSCRLF "run 100" MS$OUT MSCRLF "attach ptr " MS$OUT MS$OUT _ASM MS$OUT MSCRLF "c" MS$OUT MSCRLF "detach ptp" MS$OUT MSCRLF = 1 ;fortran "load " MS$OUT _BIN MS$OUT "/fortran1.abs" MS$OUT MSCRLF "attach ptr " MS$OUT $DUP MS$OUT _FTN MS$OUT MSCRLF "attach ptp " MS$OUT $DUP MS$OUT ".tmp" MS$OUT MSCRLF "run 100" MS$OUT MSCRLF "load " MS$OUT _BIN MS$OUT "/fortran2.abs" MS$OUT MSCRLF "attach ptr " MS$OUT $DUP MS$OUT ".tmp" MS$OUT MSCRLF "attach ptp " MS$OUT MS$OUT ".rel" MS$OUT MSCRLF "run 100" MS$OUT MSCRLF "detach ptp" MS$OUT MSCRLF = 2 ;algol "load " MS$OUT _BIN MS$OUT "/algol.abs" MS$OUT MSCRLF "attach ptr " MS$OUT $DUP MS$OUT _ALG MS$OUT MSCRLF "attach ptp " MS$OUT MS$OUT ".rel" MS$OUT MSCRLF "run 100" MS$OUT MSCRLF "detach ptp" MS$OUT MSCRLF ENDCASE +LOOP "d 2-76777 0" MS$OUT MSCRLF "load " MS$OUT _BIN MS$OUT "/" MS$OUT _BCS MS$OUT MSCRLF "d s 40000" MS$OUT MSCRLF "Output file (include .abs ext): " $PRINT $IN "attach ptp " MS$OUT MS$OUT MSCRLF #1 NumFiles GET +DO "attach ptr " MS$OUT MS$OUT ".rel" MS$OUT MSCRLF INDEX #1 SUB IFZ "run 2" ELSE "c" ENDIF MS$OUT MSCRLF Y>S DUP #1 SUB IFZ DROP ELSE 2 SWAP +DO ;write extra c's for extra segments "c" MS$OUT MSCRLF +LOOP ENDIF +LOOP "d s 40004" MS$OUT MSCRLF "attach ptr " MS$OUT _BIN MS$OUT "/bcslib.rel" MS$OUT MSCRLF "c" MS$OUT MSCRLF ;put a halt in location 2 ;this is screwy, should not be needed! "d 2 102066" MS$OUT MSCRLF ;otherwise bcs31k.abs locks up at the end of the run instead ;of halting. Such behavior doesn't happen when running BCS31K ;from disk using the siobcs.ipl LINK word. The output binaries ;appear to operate the same except for the halt address, the ;test binary made by this script halts with P=74074, whereas ;the binary made by LINK word and disk copy of BCS31K ;halts with P=74072. Mem dumps of ABS output... ;Script produced... LINK produced... (same .rel files) ;74070: 002400 CLA 002400 CLA ;74071: 114106 JSB 106,I 102077 HLT 77 ;74072: 074072 STB 72 026071 JMP 74071 ;74073: 102077 HLT 77 102077 HLT 77 ;74074: 026073 JMP 74073 026073 JMP 74073 ;74075: 074076 STB 76 074076 STB 76 ;loc 106 = 74072 loc 106 = 0 ;Doing a d 70000 102066 makes it halt too, so somewhere bcs31k.abs ;is doing a wild jump when run manually or from a script, but when ;run from HP-IPL/OS disk file it works properly and halts w/77. ;Either way the output ABS programs appear to work fine so not too ;concerned about it other than it being an indication I might need ;to tweak the bcs31k.abs creation procedure (or something else). "c" MS$OUT MSCRLF "detach ptp" MS$OUT MSCRLF "Done. Detach ptp then c" $PRINT HLT ENDIF END ; ; Change these as needed... ; DEFINE $ASM ".asm" END DEFINE $FTN ".ftn" END DEFINE $ALG ".alg" END DEFINE $SIO "sio.abs" END DEFINE $BCS "bcs31k.abs" END DEFINE $BIN "bin" END ; CONSOLE