; MKBCS 10/26/07 6/13/11 3/6/21 ; ; 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 ALGOL/FORTRAN ; file (EXTASMB only supports one segment so doesn't ask). ; 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 "Assembly files can have only one segment so doesn't ask." $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 Z>S DUP S>Z IFZ ;the assembler only supports 1 segment #1 S>Y ELSE "# Segments: " $PRINT $IN 40 $APPEND $VAL DUP IFZ DROP #1 ENDIF ;if enter assume 1 S>Y ;save #segs on Y dir ENDIF 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 "set lpt disabled" MS$OUT MSCRLF ;6/13/11 ; 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 0-77677 0" MS$OUT MSCRLF ;6/13/11 ; "load " MS$OUT _BIN MS$OUT "/" MS$OUT _SIO MS$OUT MSCRLF no longer works "attach -e ptr " MS$OUT _BIN MS$OUT "/" MS$OUT _SIO MS$OUT MSCRLF ;3/6/21 "boot ptr" MS$OUT MSCRLF ;3/6/21 Z>S ;get type CASE = 0 ;assembly ; "load " MS$OUT _BIN MS$OUT "/extasmb.abs" MS$OUT MSCRLF "attach -e ptr " MS$OUT _BIN MS$OUT "/extasmb.abs" MS$OUT MSCRLF ;3/6/21 "boot ptr" MS$OUT MSCRLF ;3/6/21 "d s 0" MS$OUT MSCRLF ;3/6/21 "attach -e 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 -e 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 -e ptr " MS$OUT _BIN MS$OUT "/fortran1.abs" MS$OUT MSCRLF ;3/6/21 "boot ptr" MS$OUT MSCRLF ;3/6/21 "d s 0" MS$OUT MSCRLF ;3/6/21 "attach -e 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 -e ptr " MS$OUT _BIN MS$OUT "/fortran2.abs" MS$OUT MSCRLF ;3/6/21 "boot ptr" MS$OUT MSCRLF ;3/6/21 "d s 0" MS$OUT MSCRLF ;3/6/21 "attach -e 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 -e ptr " MS$OUT _BIN MS$OUT "/algol.abs" MS$OUT MSCRLF ;3/6/21 "boot ptr" MS$OUT MSCRLF ;3/6/21 "d s 0" MS$OUT MSCRLF ;3/6/21 "attach -e 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 0-77677 0" MS$OUT MSCRLF ;6/13/11 ; "load " MS$OUT _BIN MS$OUT "/" MS$OUT _BCS MS$OUT MSCRLF "attach -e ptr " MS$OUT _BIN MS$OUT "/" MS$OUT _BCS MS$OUT MSCRLF ;3/6/21 "boot ptr" MS$OUT MSCRLF ;3/6/21 "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 -e 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 -e 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 ;6/13/11 was because BCS linker needs B clear! fixed "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